import { readFile } from 'node:fs/promises'; import { resolve } from 'node:path'; import { describe, expect, it } from 'vitest'; const migrationPath = resolve(import.meta.dirname, '..', '..', 'server', 'postgres', 'migrations', '006_artifact_deletion_outbox.sql'); describe('artifact deletion outbox migration', () => { it('persists opaque storage deletion work independently from the deleted artifact', async () => { const sql = await readFile(migrationPath, 'utf8'); expect(sql).toContain('CREATE TABLE assessor_artifact_deletion_outbox'); expect(sql).toContain('storage_key text NOT NULL UNIQUE'); expect(sql).toContain('next_attempt_at timestamptz NOT NULL'); expect(sql).not.toContain('REFERENCES assessor_import_artifacts'); expect(sql).toContain('assessor_artifact_deletion_outbox_due_idx'); }); });