Files
archie/ui/test/task-actions.test.ts
T
sam 5e1e365c05 feat(webui): events counts, YAML reading, log rows and dashboard filters
Four findings from the ui-redesign verification pass, each with the module that
owns the rule and the test that pins it.

- events: the three-step strip's and the tab chips' counts move out of the SFC
  into events/counts.ts -- one read per step, an unreadable count stays blank
  rather than reading as zero (events-counts.test.ts).
- workflows: workflows/workflow-yaml.ts reads the editor's YAML with a real
  parser (the yaml package, not a line scanner) to drive the read-only Steps
  preview and a live validity indicator; the editor gains a line-number gutter
  and light syntax colouring behind the textarea. Step types and their settings
  are not served to the dashboard, so those remain the server's to check on
  save, and a save it refuses still reports its own reason.
- tasks: an ERROR log row is a block rather than only red text (lib/log.ts), the
  log pane ends with "End of attempt N - M lines", and the task head offers
  Archive when the server's own action list offers it (task-actions.ts, and
  TaskRowActions' new `only` narrows the list without inventing a control).
- dashboard: the live activity feed gains the All/Tasks/System filter
  (activity-filter.ts) and every quality-gate row gains a pass bar
  (pass-bar.ts) that is red when the gate is failing.

ui/dist regenerated; ui/package.json carries yaml ^2.9.1.
2026-09-30 11:41:33 +10:00

37 lines
1.1 KiB
TypeScript

import assert from "node:assert/strict";
import test from "node:test";
const { shownActionIds } = await import("../src/tasks/task-actions.ts");
test("a surface renders every control the server offers when it does not narrow", () => {
assert.deepEqual(shownActionIds(["retry", "abandon", "reject"]), [
"retry",
"abandon",
"reject",
]);
});
test("a surface that narrows renders only the control it named", () => {
assert.deepEqual(shownActionIds(["archive", "open_pr"], ["archive"]), [
"archive",
]);
});
test("a narrowed surface never invents a control the server did not offer", () => {
assert.deepEqual(
shownActionIds(["retry", "reject"], ["archive"]),
[],
"the head offered Archive for a task the server does not let it archive",
);
});
test("a task with no action list offers nothing", () => {
assert.deepEqual(shownActionIds(undefined, ["archive"]), []);
assert.deepEqual(shownActionIds(null), []);
assert.deepEqual(shownActionIds([], ["archive"]), []);
});
test("the server's order is kept, never the surface's", () => {
assert.deepEqual(shownActionIds(["b", "a"], ["a", "b"]), ["b", "a"]);
});