Watch
0
0
Fork
You've already forked hyperhive
0

swarm-ui: start page setup assistant offers to create ruth

This commit is contained in:
damocles 2026-10-15 19:18:01 +02:00
commit 8bf53f7ed9
7 changed files with 208 additions and 15 deletions

View file

@ -0,0 +1,37 @@
// The setup assistant's "is ruth missing" check. Run by `npm test`.
import assert from "node:assert/strict";
import { test } from "node:test";
import { ruthIsMissing } from "../src/shell/ruth-missing.ts";
const answering =
(body, ok = true) =>
async () => ({
ok,
json: async () => body,
});
test("a roster without ruth means ruth is missing", async () => {
assert.equal(
await ruthIsMissing(answering([{ name: "atlas" }, { name: "argus" }])),
true,
);
assert.equal(await ruthIsMissing(answering([])), true);
});
test("a roster with ruth means she is not missing", async () => {
assert.equal(
await ruthIsMissing(answering([{ name: "atlas" }, { name: "ruth" }])),
false,
);
});
test("anything but a clear answer is not missing", async () => {
assert.equal(await ruthIsMissing(answering([], false)), false);
assert.equal(await ruthIsMissing(answering({ not: "a list" })), false);
assert.equal(
await ruthIsMissing(async () => {
throw new Error("offline");
}),
false,
);
});