Files
archie/ui/test/log-lines.test.ts
T
sam 4c655c909a 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

32 lines
1.1 KiB
TypeScript

import assert from "node:assert/strict";
import test from "node:test";
const { attemptFooter, rowClass } = await import("../src/lib/log.ts");
test("an ERROR row is a block, not only red text", () => {
const classes = rowClass("ERROR");
assert.match(classes, /bg-danger-soft/);
assert.match(classes, /border-l-danger/);
});
test("every other level keeps the plain row, still carrying its left edge", () => {
for (const level of ["WARN", "INFO", "DEBUG", "info", "", null, undefined]) {
const classes = rowClass(level);
assert.doesNotMatch(classes, /danger/, `${String(level)} wore the error row`);
assert.match(
classes,
/border-l-transparent/,
`${String(level)} lost the left border every row carries, so its columns shift`,
);
}
});
test("the footer names the attempt and counts its lines", () => {
assert.equal(attemptFooter(1, 1), "End of attempt 1 · 1 line");
assert.equal(attemptFooter(2, 14), "End of attempt 2 · 14 lines");
});
test("an attempt with no lines still reports itself", () => {
assert.equal(attemptFooter(1, 0), "End of attempt 1 · 0 lines");
});