import { readFile } from 'node:fs/promises'; import { resolve } from 'node:path'; import { describe, expect, it } from 'vitest'; describe('PostgreSQL import fingerprint migration', () => { it('stores one durable counter per SHA-256 hash with metadata constraints', async () => { const path = resolve(import.meta.dirname, '..', '..', 'server', 'postgres', 'migrations', '002_import_fingerprints.sql'); const sql = await readFile(path, 'utf8'); expect(sql).toContain('CREATE TABLE assessor_import_fingerprints'); expect(sql).toContain("sha256 ~ '^[a-f0-9]{64}$'"); expect(sql).toContain('import_count integer NOT NULL DEFAULT 1'); expect(sql).toContain('last_imported_at DESC'); }); });