fix: harden usage accounting idempotency
This commit is contained in:
1 parent
22fe6bf659
commit
3de1530074
14 files changed
+708
-107
No files matched your search
@@ -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();
|
||||
});
|
||||
Reference in new issue
Block a user