Watch
0
0
Fork
You've already forked hyperhive
0

swarm ui: show thinking is a toggle of its own, apart from the developer details

This commit is contained in:
iris 2026-11-16 20:35:03 +01:00 • committed by mara
commit 857b175a74

View file

@ -0,0 +1,53 @@
// Which terminal rows the two preferences hide. Run by `npm test`, which
// imports the `.ts` module as it is.
import assert from "node:assert/strict";
import { test } from "node:test";
import {
rowHidden,
rowIsFilterable,
} from "../../shared/src/terminal/row-visibility.ts";
const thinking = { level: "debug", kind: "thinking" };
const chatter = { level: "debug" };
const info = { level: "info" };
test("thinking follows show thinking alone", () => {
assert.equal(rowHidden(thinking, false, true), false);
assert.equal(
rowHidden(thinking, true, true),
false,
"developer details are hidden, thinking is not",
);
assert.equal(
rowHidden(thinking, false, false),
true,
"developer details are shown, thinking is not",
);
assert.equal(rowHidden(thinking, true, false), true);
});
test("other debug rows follow hide developer details alone", () => {
assert.equal(rowHidden(chatter, false, true), false);
assert.equal(rowHidden(chatter, true, true), true);
assert.equal(rowHidden(chatter, true, false), true);
assert.equal(
rowHidden(chatter, false, false),
false,
"hiding thinking leaves the rest",
);
});
test("a row of any other level is always shown", () => {
for (const hide of [true, false])
for (const show of [true, false]) {
assert.equal(rowHidden(info, hide, show), false);
assert.equal(rowHidden({ level: "error" }, hide, show), false);
}
});
test("only debug and thinking rows can be hidden", () => {
assert.equal(rowIsFilterable(thinking), true);
assert.equal(rowIsFilterable(chatter), true);
assert.equal(rowIsFilterable(info), false);
assert.equal(rowIsFilterable({ level: "warn" }), false);
});