import assert from "node:assert/strict"; import { readFile } from "node:fs/promises"; import { join } from "node:path"; import test from "node:test"; const dashboardThemePath = join( process.cwd(), "components", "dashboard-theme.tsx", ); test("DashboardThemeProvider keeps server and first client render stable", async () => { const source = await readFile(dashboardThemePath, "utf8"); assert.match(source, /useSyncExternalStore\(/); assert.match(source, /function getServerDashboardTheme\(\): DashboardTheme \{/); assert.match(source, /return "light";/); assert.doesNotMatch( source, /useState\(\(\) => \{[\s\S]*?localStorage/, ); assert.doesNotMatch(source, /setTheme\(/); });