diff --git a/src/admin/theme.test.ts b/src/admin/theme.test.ts index a0b32c7..7b7f6cc 100644 --- a/src/admin/theme.test.ts +++ b/src/admin/theme.test.ts @@ -1,6 +1,23 @@ import { describe, it, expect } from "vitest"; import { theme } from "./theme"; +/** Minimal palette shape used by the colorSchemes assertions below. */ +interface SchemesPalette { + primary: { main: string }; + background: { default: string; paper: string }; + error: { main: string }; + success: { main: string }; +} +interface ColorScheme { + palette: SchemesPalette; +} +interface ThemeWithColorSchemes { + colorSchemes: { light: ColorScheme; dark: ColorScheme }; +} + +/** Single typed assertion so every `colorSchemes.*` access below is checked. */ +const themedSchemes = (theme as unknown as ThemeWithColorSchemes).colorSchemes; + describe("MUI theme", () => { it("uses the brand fonts", () => { expect(theme.typography.fontFamily).toContain("Plus Jakarta Sans"); @@ -8,18 +25,18 @@ describe("MUI theme", () => { }); it("maps the brand red per color scheme", () => { - expect(theme.colorSchemes.light.palette.primary.main).toBe("#c73030"); - expect(theme.colorSchemes.dark.palette.primary.main).toBe("#d63031"); + expect(themedSchemes.light.palette.primary.main).toBe("#c73030"); + expect(themedSchemes.dark.palette.primary.main).toBe("#d63031"); }); it("maps the refreshed light canvas + paper", () => { - expect(theme.colorSchemes.light.palette.background.default).toBe("#f4f3f1"); - expect(theme.colorSchemes.light.palette.background.paper).toBe("#ffffff"); + expect(themedSchemes.light.palette.background.default).toBe("#f4f3f1"); + expect(themedSchemes.light.palette.background.paper).toBe("#ffffff"); }); it("maps semantic colors per scheme", () => { - expect(theme.colorSchemes.light.palette.error.main).toBe("#b91c1c"); - expect(theme.colorSchemes.dark.palette.success.main).toBe("#22c55e"); + expect(themedSchemes.light.palette.error.main).toBe("#b91c1c"); + expect(themedSchemes.dark.palette.success.main).toBe("#22c55e"); }); it("uses the base radius of 10", () => {