Files
archie/ui/test/live-state.test.ts
T
sam 84e84cac5f feat(webui): needs-you first Dashboard
The header states what is running and what needs a human instead of a
greeting. A stat strip replaces the throughput tiles. The main column
opens on a Needs you queue: each waiting task with its status, title,
repository, workflow and park reason, an Open link and the actions the
server offers for it. Live activity follows; quality gates and the token
outlook move to a right rail.

A failed task-list fetch no longer reads as an empty list, which would
have told the operator nothing needs them; the header says it cannot
reach archied instead.
2026-09-25 16:25:19 +10:00

64 lines
2.2 KiB
TypeScript

import assert from "node:assert/strict";
import { readFile } from "node:fs/promises";
import test from "node:test";
const { resourcesForEvent } = await import("../src/stores/live-events.ts");
const passiveRefreshSurfaces = [
"../src/dashboard/DashboardHero.vue",
"../src/dashboard/NeedsYouCard.vue",
"../src/tasks/TasksPage.vue",
"../src/tasks/TaskHeader.vue",
"../src/tasks/TasksState.vue",
"../src/workflows/WorkflowsPage.vue",
"../src/skills/SkillsPage.vue",
"../src/curators/CuratorsPage.vue",
"../src/channels/ChannelsPage.vue",
"../src/bindings/BindingsPage.vue",
"../src/logs/LogActions.vue",
"../src/settings/SystemStatusPage.vue",
"../src/settings/SystemTasksPage.vue",
"../src/settings/SystemModelsPage.vue",
"../src/settings/SystemReposPage.vue",
"../src/settings/SystemAdvancedPage.vue",
"../src/tasks/PanelError.vue",
"../src/tasks/TaskLogs.vue",
];
test("pages do not expose passive refresh controls", async () => {
for (const path of passiveRefreshSurfaces) {
const source = await readFile(new URL(path, import.meta.url), "utf8");
assert.doesNotMatch(source, />\s*(Refresh|Retry)\s*</, path);
}
});
test("a 401 does not offer a reload that cannot restore authentication", async () => {
const source = await readFile(
new URL("../src/tasks/TaskRowActions.vue", import.meta.url),
"utf8",
);
assert.doesNotMatch(source, /Reload to sign in|window\.location\.reload/);
});
test("the application starts one Pinia-owned live update stream", async () => {
const main = await readFile(
new URL("../src/main.ts", import.meta.url),
"utf8",
);
assert.match(main, /useLiveUpdatesStore\(pinia\)\.initialize\(\)/);
});
test("backend events invalidate only their owning projections", () => {
assert.deepEqual(resourcesForEvent({ kind: "stage_finish", task_id: 42 }), [
"tasks",
]);
assert.deepEqual(resourcesForEvent({ kind: "task_queued" }), ["tasks"]);
assert.deepEqual(resourcesForEvent({ kind: "capture" }), ["captures"]);
assert.deepEqual(resourcesForEvent({ kind: "curator_action" }), [
"curators",
"skills",
]);
assert.deepEqual(resourcesForEvent({ kind: "update_report" }), ["updates"]);
assert.deepEqual(resourcesForEvent({ kind: "log" }), []);
});