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(); await testDb.insertDownload({ ...seed, idempotencyKey: "same-request" }); await expect( testDb.insertDownload({ ...seed, idempotencyKey: "same-request" }), ).rejects.toThrow(); });