fix(create): prevent duplicate rapid submissions
This commit is contained in:
14
web/test/creation-submit-gate.test.ts
Normal file
14
web/test/creation-submit-gate.test.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { expect, test } from "bun:test";
|
||||
|
||||
import { createCreationSubmitGate } from "../src/pages/create/creation-submit-gate";
|
||||
|
||||
test("creation submit gate rejects a second submit until the first submit releases it", () => {
|
||||
const gate = createCreationSubmitGate();
|
||||
|
||||
expect(gate.tryAcquire()).toBe(true);
|
||||
expect(gate.tryAcquire()).toBe(false);
|
||||
|
||||
gate.release();
|
||||
|
||||
expect(gate.tryAcquire()).toBe(true);
|
||||
});
|
||||
Reference in New Issue
Block a user