feat: build audit outreach review workspace
This commit is contained in:
23
tests/dashboard-theme.test.ts
Normal file
23
tests/dashboard-theme.test.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
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<DashboardTheme>\(\(\) => \{[\s\S]*?localStorage/,
|
||||
);
|
||||
assert.doesNotMatch(source, /setTheme\(/);
|
||||
});
|
||||
Reference in New Issue
Block a user