fix: harden usage accounting idempotency

This commit is contained in:
Leon Tonhäuser committed 2026-08-10 10:59:12 +02:00
1 parent 22fe6bf659
commit 3de1530074
14 files changed
+708 -107

No files matched your search

+3 -2
View File
@@ -7,10 +7,11 @@ 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: "same-request" });
await testDb.insertDownload({ ...seed, idempotencyKey });
await expect(
testDb.insertDownload({ ...seed, idempotencyKey: "same-request" }),
testDb.insertDownload({ ...seed, idempotencyKey }),
).rejects.toThrow();
});