import assert from "node:assert/strict"; import { readFile } from "node:fs/promises"; import test from "node:test"; const source = (path) => readFile(new URL(`../../${path}`, import.meta.url), "utf8"); test("the eager application shell does not import the shared lucide vendor chunk", async () => { const files = await Promise.all([ source("src/components/Layout.tsx"), source("src/components/PluginRouteGuard.tsx"), source("src/components/UserBootstrapPanel.tsx"), ]); for (const file of files) { assert.doesNotMatch(file, /from "lucide-react"/); assert.match(file, /from "\.\/shell-icons"/); } }); test("the sidebar is code-split out of the shell and only warmed for returning sessions", async () => { const layout = await source("src/components/Layout.tsx"); assert.match(layout, /const Sidebar = lazy\(\(\) => import\("\.\/Sidebar"\)/); assert.match(layout, /currentUserId/); assert.match(layout, /import\("\.\/Sidebar"\)/); }); test("annotation workspace CSS loads with the annotation route, not the entry stylesheet", async () => { const [indexCss, workbench] = await Promise.all([ source("src/index.css"), source("src/components/CaptureAnnotationWorkbench.tsx"), ]); assert.doesNotMatch(indexCss, /styles\/capture-workspace\.css/); assert.match(workbench, /styles\/capture-workspace\.css/); }); test("below-the-fold dashboard panels are lazily imported", async () => { const dashboard = await source("src/pages/Dashboard.tsx"); assert.match(dashboard, /const WorkforceStatisticsPanel = lazy\(/); assert.match(dashboard, /const ProductionStatistics = lazy\(/); });