diff --git a/webui/package.json b/webui/package.json index 3206ec5..32fc4e1 100644 --- a/webui/package.json +++ b/webui/package.json @@ -6,6 +6,9 @@ "main": "src/index.ts", "module": "src/index.ts", "types": "src/index.ts", + "scripts": { + "test:organizations-tree": "node scripts/test-organizations-tree-structure.mjs" + }, "exports": { ".": { "types": "./src/index.ts", diff --git a/webui/scripts/test-organizations-tree-structure.mjs b/webui/scripts/test-organizations-tree-structure.mjs new file mode 100644 index 0000000..9d2ada4 --- /dev/null +++ b/webui/scripts/test-organizations-tree-structure.mjs @@ -0,0 +1,24 @@ +import { readFileSync } from "node:fs"; + +function assert(condition, message) { + if (!condition) throw new Error(message); +} + +const source = readFileSync( + new URL("../src/features/organizations/OrganizationsPage.tsx", import.meta.url), + "utf8" +); +const styles = readFileSync( + new URL("../src/styles/organizations.css", import.meta.url), + "utf8" +); + +assert(source.includes("ExplorerTree,"), "Organizations imports the central ExplorerTree"); +assert(source.includes(" = new Set()): JSX.Element[] { - return (unitsByParentId.get(parentId) ?? []).flatMap((unit) => { - if (seen.has(unit.id)) return []; - const nextSeen = new Set(seen); - nextSeen.add(unit.id); - return [ -
- - -
, - ...renderUnitTreeNodes(unit.id, depth + 1, nextSeen) - ]; - }); - } - function renderUnitsSection() { return (