61 lines
2.1 KiB
JavaScript
61 lines
2.1 KiB
JavaScript
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"
|
|
);
|
|
const moduleSource = readFileSync(
|
|
new URL("../src/module.ts", import.meta.url),
|
|
"utf8"
|
|
);
|
|
const apiSource = readFileSync(
|
|
new URL("../src/api/organizations.ts", import.meta.url),
|
|
"utf8"
|
|
);
|
|
|
|
assert(source.includes("ExplorerTree,"), "Organizations imports the central ExplorerTree");
|
|
assert(source.includes("<ExplorerTree"), "the organization hierarchy uses ExplorerTree");
|
|
assert(source.includes("collapsible={false}"), "the always-expanded hierarchy uses the non-collapsible contract");
|
|
assert(source.includes("renderNodeActions="), "per-unit controls use the sibling node-action slot");
|
|
assert(source.includes("<IconButton"), "per-unit controls use the central icon-only action primitive");
|
|
assert(!source.includes("renderUnitTreeNodes"), "the custom recursive renderer was removed");
|
|
assert(!source.includes("organizations-tree-row"), "the custom tree row was removed");
|
|
assert(!source.includes("organizations-tree-node"), "the custom tree node was removed");
|
|
assert(!styles.includes("organizations-tree-"), "Organizations no longer owns shared tree styling");
|
|
assert(
|
|
moduleSource.includes('"admin.sections": organizationAdminSections'),
|
|
"organization governance settings use the shared admin layout"
|
|
);
|
|
for (const operation of [
|
|
"createUnit",
|
|
"patchUnit",
|
|
"createFunction",
|
|
"patchFunction"
|
|
]) {
|
|
assert(
|
|
source.includes(operation),
|
|
`the organization editor exposes ${operation}`
|
|
);
|
|
assert(
|
|
apiSource.includes(`function ${operation}`),
|
|
`the organization API client defines ${operation}`
|
|
);
|
|
}
|
|
assert(
|
|
source.includes("is_active: draft.is_active"),
|
|
"organization editors persist active and inactive state"
|
|
);
|
|
assert(
|
|
source.includes('id="organizations-units"')
|
|
&& source.includes('id="organizations-functions"'),
|
|
"unit and function lists use the shared DataGrid"
|
|
);
|