import { expect, it } from "vitest"; import { DEFAULT_THEME, normalizeTheme } from "./theme"; // YouTube and Starship were retired with no data migration (owner, 2026-09-24): an account or // a browser that still stores one must land on the default scheme, not on an html[data-scheme] that no // CSS block styles (an unstyled page), and the retired tuner flag must not ride along into the next save. it("maps a retired scheme to the default and keeps only the known keys", () => { const t = normalizeTheme({ mode: "light", scheme: "youtube", fontScale: 1.1, bgImage: false, bgFade: 35, ...{ showTuner: true }, }); expect(t).toEqual({ mode: "light", scheme: "midnight", fontScale: 1.1, bgImage: false, bgFade: 35, }); }); it("keeps a live scheme and fills what is missing or malformed from the defaults", () => { expect(normalizeTheme({ scheme: "matrix", mode: "sepia", fontScale: Number.NaN })).toEqual({ ...DEFAULT_THEME, scheme: "matrix", }); });