29 lines
2.2 KiB
JavaScript
29 lines
2.2 KiB
JavaScript
import { readFileSync } from "node:fs";
|
|
|
|
function source(path) {
|
|
return readFileSync(new URL(path, import.meta.url), "utf8");
|
|
}
|
|
|
|
function assert(condition, message) {
|
|
if (!condition) throw new Error(message);
|
|
}
|
|
|
|
const page = source("../src/features/organizations/OrganizationsPage.tsx");
|
|
const settings = source("../src/features/organizations/OrganizationsAdminPanel.tsx");
|
|
const patterns = source("../src/features/organizations/interfacePatterns.ts");
|
|
const moduleSource = source("../src/module.ts");
|
|
const translations = source("../src/i18n/generatedTranslations.ts");
|
|
|
|
assert(page.includes("DocumentationHelpLink") && settings.includes("DocumentationHelpLink"), "Workspace and tenant settings expose contextual documentation");
|
|
assert(page.includes("ActionBlockerHint") && settings.includes("ActionBlockerHint"), "Read-only states identify action, actor, and destination");
|
|
assert(page.includes("disabledReason") && settings.includes("disabledReason"), "Unavailable organization actions explain their state");
|
|
assert(page.includes("requestDiscard(() => void loadModel())") && settings.includes("requestDiscard(() => void load())"), "Reload preserves dirty organization drafts and settings");
|
|
assert(page.includes("hasDirtyDraft ? requestDiscard(discardDrafts)"), "Editor close uses the shared unsaved-change guard");
|
|
assert(page.includes("ORGANIZATIONS_FIELD_DOCUMENTATION"), "Model fields link to stable consequence documentation");
|
|
assert(patterns.includes('topicId: "organizations.model"') && patterns.includes('topicId: "organizations.reference.fields-and-consequences"'), "Organizations uses manifest-backed help references");
|
|
assert(moduleSource.includes('version: "0.1.8"') && moduleSource.includes('label: "i18n:govoplan-organizations.organizations_administration"'), "WebUI metadata matches the module release and localizes its composed surface");
|
|
assert(translations.includes('"i18n:govoplan-organizations.read_only_summary"'), "Blocker explanations are present in the translation catalogue");
|
|
assert(!page.includes("window.confirm"), "Organizations does not use browser-native consequential confirmation");
|
|
|
|
console.log("Organizations surfaces satisfy the recorded interface pattern-language contract.");
|