chore: import ovis-composer into repo with baseline tests
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
1 parent
edf09cf532
commit
c05e252d79
21 files changed
+4312
No files matched your search
@@ -0,0 +1,37 @@
|
||||
import test from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import { decide, gateAfter, onRestart } from "../mod/ovis-composer/delivery.js";
|
||||
|
||||
test("decide idle/done -> send", () => {
|
||||
assert.equal(decide("idle").kind, "send");
|
||||
assert.equal(decide("done").kind, "send");
|
||||
});
|
||||
|
||||
test("decide working -> queue, blocked -> hold", () => {
|
||||
assert.equal(decide("working").kind, "queue");
|
||||
assert.equal(decide("blocked").kind, "hold");
|
||||
});
|
||||
|
||||
test("decide unknown status -> queue", () => {
|
||||
assert.equal(decide("error").kind, "queue");
|
||||
});
|
||||
|
||||
test("gateAfter needs a seen working turn", () => {
|
||||
assert.equal(gateAfter("idle", false), false);
|
||||
assert.equal(gateAfter("idle", true), true);
|
||||
assert.equal(gateAfter("done", true), true);
|
||||
assert.equal(gateAfter("working", true), false);
|
||||
});
|
||||
|
||||
test("onRestart sending -> uncertain, others untouched", () => {
|
||||
const out = onRestart([
|
||||
{ id: "1", state: "sending" },
|
||||
{ id: "2", state: "queued" },
|
||||
{ id: "3", state: "held" },
|
||||
]);
|
||||
assert.deepEqual(out.map((i) => i.state), ["uncertain", "queued", "held"]);
|
||||
});
|
||||
|
||||
test("onRestart tolerates non-array", () => {
|
||||
assert.deepEqual(onRestart(null), []);
|
||||
});
|
||||
Reference in new issue
Block a user