Files
archie/ui/test/nav-specs.test.ts
T
sam f1c595d39b fix(ui): name only the pages the sidebars can open (#2148)
Removing the old services' pages left their entries in the sidebar specs, and a
nav entry with no route threw during the first render, so the shell drew
nothing and every page was blank. The chat browser test caught it, which is
the failure #2148 recorded; it passes again.

The spec list moves to ui/src/lib/nav-specs.ts, which imports nothing, so a
test can check every address it names against the generated page catalogue.
That is the guard: deleting a page without updating the sidebars now fails
the gate instead of the browser.
2026-11-27 19:13:33 +11:00

23 lines
818 B
TypeScript

import assert from "node:assert/strict";
import { readFileSync } from "node:fs";
import test from "node:test";
import { navPaths } from "../src/lib/nav-specs.ts";
const pages: { path: string }[] = JSON.parse(
readFileSync(new URL("../pages/pages.json", import.meta.url), "utf8"),
);
// Guards the regression #2121 shipped: the sidebars kept naming pages that were
// removed, and the first render of a nav entry with no route threw, leaving the
// dashboard blank. A page the catalogue does not list is one the router cannot
// open.
test("every destination the sidebars name is a page the dashboard serves", () => {
const known = new Set(pages.map((page) => page.path));
assert.deepEqual(
navPaths().filter((path) => !known.has(path)),
[],
"the sidebars name addresses no page answers",
);
});