swarm ui: show thinking is a toggle of its own, apart from the developer details
This commit is contained in:
parent
2e9a65b414
commit
857b175a74
1 changed files with 243 additions and 25 deletions
53
frontend/packages/swarm-ui/test/row-visibility.test.mjs
Normal file
53
frontend/packages/swarm-ui/test/row-visibility.test.mjs
Normal 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);
|
||||
});
|
||||
Loading…
Reference in a new issue