openpetswithchatandmcp/apps/desktop/tests/shared-ui-split.test.ts
2026-06-19 02:54:29 +00:00

18 lines
1.5 KiB
TypeScript

import assert from "node:assert/strict";
import { readFileSync } from "node:fs";
import { dirname, resolve } from "node:path";
import { fileURLToPath } from "node:url";
const desktopRoot = process.env.FAMILIAROS_DESKTOP_ROOT ?? resolve(dirname(fileURLToPath(import.meta.url)), "..");
const sharedUiSource = readFileSync(resolve(desktopRoot, "src/renderer/src/control-center/shared-ui.tsx"), "utf8");
const sharedUiIconsSource = readFileSync(resolve(desktopRoot, "src/renderer/src/control-center/shared-ui-icons.tsx"), "utf8");
const sharedUiNavigationSource = readFileSync(resolve(desktopRoot, "src/renderer/src/control-center/shared-ui-navigation.tsx"), "utf8");
assert.match(sharedUiSource, /from "\.\/shared-ui-icons"/, "Shared UI shell must import the extracted icon seam.");
assert.match(sharedUiSource, /from "\.\/shared-ui-navigation"/, "Shared UI shell must import the extracted navigation seam.");
assert.match(sharedUiIconsSource, /export const DashboardIcon/, "Shared UI icon seam must export dashboard navigation icons.");
assert.match(sharedUiIconsSource, /export const Spinner/, "Shared UI icon seam must export the shared spinner.");
assert.match(sharedUiNavigationSource, /export const navTabs/, "Shared UI navigation seam must export Control Center navigation metadata.");
assert.match(sharedUiNavigationSource, /export function initialControlCenterRoute/, "Shared UI navigation seam must export initial route resolution.");
console.error("Shared UI split validation passed.");