Files
archie/ui/test/events-tabs.test.ts
T
sam ea6385879f fix(ui): stop calling operations the binary does not serve (#2121)
The dashboard is embedded in the single binary, which serves api/openapi.yaml.
It was still calling the old services' routes, so pages that read them answered
with a not-found: the task board, its activity feed and setup panel, logs,
alerts, audit and its export, bindings, schedules, channels, repositories,
skills, curators, the control-plane settings pages, identities and org agents,
the org switcher, secret-reference checks, task metadata, and the audit, usage,
summary and version reads.

Each of those surfaces is removed, and a test compares every /api path in the
dashboard's source with api/openapi.yaml so the next one fails the gate
instead of the browser. Settings that the binary does serve (model providers,
instructions, policies, members) keep their pages.
2026-11-27 19:03:02 +11:00

32 lines
1.7 KiB
TypeScript

import assert from "node:assert/strict";
import test from "node:test";
import { activeTab, availableTabs } from "../src/pages/events/lib/tab-selection.ts";
test("Events hides only capabilities explicitly disabled by the server", () => {
const cases: Array<[Record<string, boolean> | null | undefined, string[]]> = [
[null, ["events", "sources", "triggers", "inspector", "mappings"]],
[undefined, ["events", "sources", "triggers", "inspector", "mappings"]],
[{ captures: true, events: false }, ["inspector", "mappings"]],
[{ events: false, captures: true, mappings: true }, ["inspector", "mappings"]],
[{ events: true, captures: false, mappings: false }, ["events", "sources", "triggers"]],
[{ events: false, captures: false, mappings: false }, []],
];
for (const [sections, expected] of cases) {
assert.deepEqual(availableTabs(sections).map((tab) => tab.id), expected, JSON.stringify(sections));
}
});
test("Events bookmarks select an available tab or fall back to the first", () => {
const cases: Array<[Record<string, boolean> | null, string, string]> = [
[null, "mappings", "mappings"],
[{ events: false, captures: false, mappings: false }, "inspector", ""],
[{ events: false, captures: false, mappings: false }, "", ""],
// A bookmark for a tab this build no longer offers falls back.
[{ events: true, captures: false, mappings: false }, "curators", "events"],
[{ events: false, captures: false, mappings: false }, "curators", ""],
];
for (const [sections, requested, expected] of cases) {
assert.equal(activeTab(requested, availableTabs(sections)), expected, `${JSON.stringify(sections)}: ${requested}`);
}
});