// frontend/tests/tokens.test.ts — 디자인 토큰 값이 원본 dash.css :root 와 일치하는지 회귀 import fs from "node:fs"; import path from "node:path"; import { describe, expect, it } from "vitest"; const css = fs.readFileSync(path.resolve(__dirname, "../styles/tokens.css"), "utf8"); const cases: [string, string][] = [ ["--bg-top", "#f6efe7"], ["--bg-mid", "#eef0f1"], ["--bg-bot", "#e9ebed"], ["--card", "#ffffff"], ["--ink", "#211f1c"], ["--ink-2", "#514d47"], ["--muted", "#8d8a85"], ["--faint", "#b6b3ad"], ["--fill", "#29241f"], ["--on-fill", "#f4efe6"], ["--blue", "#4f72e0"], ["--coral", "#df7256"], ["--green", "#4e9b66"], ["--violet", "#8b6fd4"], ["--amber", "#e0a23c"], ["--lime", "#c2f24a"], ["--lime-ink", "#233006"], ["--radius", "22px"], ["--radius-sm", "14px"], ]; describe("tokens.css 충실도", () => { for (const [name, val] of cases) { it(`${name} = ${val}`, () => { const re = new RegExp( `${name}\\s*:\\s*${val.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}`, "i", ); expect(css).toMatch(re); }); } it("다크 오버라이드 존재 (--card #2c2925)", () => { expect(css).toMatch(/\[data-theme="dark"\]/); expect(css).toMatch(/--card:\s*#2c2925/i); }); });