Skip to content

Commit deb7165

Browse files
committed
test(webapp): update the theme preference tests for the new theme set
The test's VALID_THEMES still listed "classic", which this branch removed from the enum, so both loops asserted a value the schema now rejects. Swapped in the current set and pinned the migration behaviour the removal implies: a stored "classic" normalizes to dark and parses to undefined. These are excluded from tsconfig.check.json, so the stale annotation never surfaced in typecheck.
1 parent 674559e commit deb7165

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

apps/webapp/test/themePreference.test.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { describe, expect, it } from "vitest";
22
import { parseDashboardPreferences } from "~/utils/dashboardPreferences";
33
import { normalizeThemePreference, type ThemePreference } from "~/utils/themePreference";
44

5-
const VALID_THEMES: ThemePreference[] = ["classic", "system", "dark", "light"];
5+
const VALID_THEMES: ThemePreference[] = ["system", "dark", "light", "black", "white"];
66

77
describe("normalizeThemePreference", () => {
88
it("returns each valid value unchanged", () => {
@@ -12,6 +12,9 @@ describe("normalizeThemePreference", () => {
1212
});
1313

1414
it("falls back to dark for legacy/unknown values", () => {
15+
// Classic is retired. Anyone still holding it lands on Dark, which at
16+
// contrast 0 renders the palette Classic used to ship.
17+
expect(normalizeThemePreference("classic")).toBe("dark");
1518
expect(normalizeThemePreference("solarized")).toBe("dark");
1619
expect(normalizeThemePreference("")).toBe("dark");
1720
expect(normalizeThemePreference(42)).toBe("dark");
@@ -24,13 +27,18 @@ describe("normalizeThemePreference", () => {
2427
});
2528

2629
describe("DashboardPreferences theme schema", () => {
27-
it("accepts all four theme values", () => {
30+
it("accepts every theme value", () => {
2831
for (const theme of VALID_THEMES) {
2932
const result = parseDashboardPreferences({ version: "1", projects: {}, theme });
3033
expect(result.theme).toBe(theme);
3134
}
3235
});
3336

37+
it("drops a stored classic theme", () => {
38+
const result = parseDashboardPreferences({ version: "1", projects: {}, theme: "classic" });
39+
expect(result.theme).toBeUndefined();
40+
});
41+
3442
it("accepts preferences without a theme", () => {
3543
const result = parseDashboardPreferences({ version: "1", projects: {} });
3644
expect(result.theme).toBeUndefined();

0 commit comments

Comments
 (0)