Spaces:
Sleeping
Sleeping
File size: 805 Bytes
a93f6a2 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | import assert from "node:assert/strict";
import test from "node:test";
import { THEMES, nextTheme, resolveTheme } from "../features/studio/theme.js";
test("resolveTheme defaults invalid/empty to auto", () => {
assert.equal(resolveTheme(null), "auto");
assert.equal(resolveTheme("nonsense"), "auto");
assert.equal(resolveTheme("dark"), "dark");
});
test("nextTheme cycles auto -> light -> dark -> auto", () => {
assert.equal(nextTheme("auto"), "light");
assert.equal(nextTheme("light"), "dark");
assert.equal(nextTheme("dark"), "auto");
});
test("nextTheme normalizes invalid input first", () => {
assert.equal(nextTheme("garbage"), "light"); // treated as auto -> light
});
test("THEMES are the three supported modes", () => {
assert.deepEqual(THEMES, ["auto", "light", "dark"]);
});
|