import assert from "node:assert/strict"; import { dirname, join } from "node:path"; import { test } from "node:test"; import { fileURLToPath } from "node:url"; import * as ejs from "ejs"; const themeSwitch = join(dirname(fileURLToPath(import.meta.url)), "..", "..", "views", "partials", "theme-switch.ejs"); const render = (data: Record = {}): Promise => ejs.renderFile(themeSwitch, data); const flat = (s: string): string => s.replace(/>\s+<").replace(/\s+/g, " ").trim(); test("theme switch renders the Light/Auto/Dark radiogroup with CSS-coupled ids", async () => { // ids must be theme-light/auto/dark — styles.css keys html:has(#theme-…:checked) off them. const html = flat(await render({ value: "dark", label: "Appearance" })); assert.match(html, /
/); assert.match(html, /