49 lines
1.4 KiB
JavaScript
49 lines
1.4 KiB
JavaScript
import { readFileSync } from "node:fs";
|
|
|
|
function assert(condition, message) {
|
|
if (!condition) throw new Error(message);
|
|
}
|
|
|
|
const moduleSource = readFileSync(
|
|
new URL("../src/module.ts", import.meta.url),
|
|
"utf8"
|
|
);
|
|
const tenantsSource = readFileSync(
|
|
new URL("../src/features/admin/TenantsPanel.tsx", import.meta.url),
|
|
"utf8"
|
|
);
|
|
const settingsSource = readFileSync(
|
|
new URL("../src/features/admin/TenantSettingsPanel.tsx", import.meta.url),
|
|
"utf8"
|
|
);
|
|
|
|
assert(
|
|
moduleSource.includes('"admin.sections": adminSections'),
|
|
"Tenancy contributes its panels through admin.sections"
|
|
);
|
|
assert(
|
|
moduleSource.includes('id: "system-tenants"'),
|
|
"Tenancy contributes the system tenant registry section"
|
|
);
|
|
assert(
|
|
moduleSource.includes('id: "tenant-settings"'),
|
|
"Tenancy contributes the active tenant settings section"
|
|
);
|
|
assert(
|
|
moduleSource.includes('surfaceId: "tenancy.admin.system-tenants"') &&
|
|
moduleSource.includes('surfaceId: "tenancy.admin.tenant-settings"'),
|
|
"Tenancy owns the view-surface namespace for both admin sections"
|
|
);
|
|
assert(
|
|
!moduleSource.includes("@govoplan/access-webui"),
|
|
"Tenancy does not import the optional Access WebUI package"
|
|
);
|
|
assert(
|
|
tenantsSource.includes("/api/tenancy"),
|
|
"The tenant registry panel consumes the tenancy-owned API client"
|
|
);
|
|
assert(
|
|
settingsSource.includes("/api/tenancy"),
|
|
"The tenant settings panel consumes the tenancy-owned API client"
|
|
);
|