16 lines
732 B
JavaScript
16 lines
732 B
JavaScript
import test from "node:test";
|
|||
|
|
import assert from "node:assert/strict";
|
||
|
|
import { createInvocationRegistry } from "../dist/invocations.js";
|
||
|
|
|
||
|
|
test("cancel requests do not acknowledge execution completion or allow replay", () => {
|
||
|
|
const registry = createInvocationRegistry();
|
||
|
|
const execution = registry.begin("call-1");
|
||
|
|
assert.equal(registry.cancel("call-1").state, "cancellation-requested");
|
||
|
|
assert.equal(execution.signal.aborted, true);
|
||
|
|
assert.equal(registry.status("call-1").state, "cancellation-requested");
|
||
|
|
execution.finish();
|
||
|
|
assert.equal(registry.status("call-1").state, "completed");
|
||
|
|
assert.throws(() => registry.begin("call-1"), /already used/);
|
||
|
|
assert.equal(registry.status("missing").state, "unknown");
|
||
|
|
});
|