import { afterAll, expect, test } from "vitest"; import { startPostgres } from "./postgres"; const testDb = await startPostgres(); afterAll(() => testDb.stop()); test("rejects duplicate download idempotency keys for one editorial", async () => { const seed = await testDb.seedEditorialWithUsage(); const idempotencyKey = "cccccccc-cccc-4ccc-8ccc-cccccccccccc"; await testDb.insertDownload({ ...seed, idempotencyKey }); await expect( testDb.insertDownload({ ...seed, idempotencyKey }), ).rejects.toThrow(); });