Files
opencode-power-pack/tests/frontend-design.test.mjs
T

37 lines
1.4 KiB
JavaScript

import { test } from "node:test";
import assert from "node:assert/strict";
import { readFileSync } from "node:fs";
import { join } from "node:path";
const REPO = process.env.REPO || process.cwd();
const skill = readFileSync(join(REPO, "skills/frontend-design/SKILL.md"), "utf8");
// Content-regression guards: these encode the improvement so it can't silently rot.
test("frontend-design: names the generic default fonts to avoid", () => {
for (const font of ["Inter", "Roboto", "Arial"]) {
assert.ok(skill.includes(font), `skill should name ${font} as a font to avoid`);
}
assert.ok(skill.includes("Space Grotesk"), "skill should warn about Space Grotesk convergence");
});
test("frontend-design: includes an objective self-critique rubric", () => {
assert.match(skill, /##\s*Self-critique/i);
assert.match(skill, /contrast/i);
assert.match(skill, /prefers-reduced-motion/);
assert.match(skill, /\balt\b/);
assert.match(skill, /focus/i);
});
test("frontend-design: keeps the optional, cross-platform validation note", () => {
assert.match(skill, /html-validate/);
assert.match(skill, /Playwright/);
// the screenshot loop must stay clearly optional / vision-gated
assert.match(skill, /opt-in|optional/i);
});
test("frontend-design: enforces variety / anti-convergence across generations", () => {
assert.match(skill, /Vary across generations/i);
assert.match(skill, /diverge/i);
});