import assert from "node:assert/strict"; import { describe, it } from "node:test"; import { buildCommandPaletteGroups } from "./commandPaletteNavigation.ts"; import { flattenNavigationGroups, navigationGroups } from "./navigationGroups.ts"; describe("buildCommandPaletteGroups", () => { it("mirrors the sidebar navigation groups without dropping routes", () => { const groups = buildCommandPaletteGroups(navigationGroups); const routes = groups.flatMap((group) => group.items.map((item) => item.path)); assert.deepEqual(groups.map((group) => group.label), navigationGroups.map((group) => group.label)); assert.deepEqual([...routes].sort(), [...flattenNavigationGroups().map((item) => item.path)].sort()); }); it("uses search labels that keep route intent readable", () => { const groups = buildCommandPaletteGroups(navigationGroups); const itemByPath = Object.fromEntries(groups.flatMap((group) => group.items.map((item) => [item.path, item]))); assert.equal(itemByPath["/"].searchLabel, "Overzicht"); assert.equal(itemByPath["/apps"].searchLabel, "Apps"); assert.equal(itemByPath["/settings"].searchLabel, "Instellingen"); assert.equal(itemByPath["/ai/security-reviewer"].searchLabel, "AI Security Reviewer"); }); });