evOo-local/packages/ui-web/src/ui-scale-guard.test.ts
cynarAI 6c7eed7580 Initial clean evOo-local from f00577b
Fresh history cut from cynarAI/evoo antigravity-handoff/project-timeline
(Voice First + project timeline). Brand docs/titles as evOo; keep @rakazo/*
packages as tech debt. Excludes node_modules, caches, secrets, voice blobs.
2026-09-20 17:15:16 +02:00

39 lines
1.2 KiB
TypeScript

import { readdirSync, readFileSync, statSync } from "node:fs";
import { join } from "node:path";
import { describe, expect, it } from "vitest";
const SHELL_ROOT = join(import.meta.dirname, "../../../apps/web/src/pages");
/** Primary shell surfaces must not use sub-label pixel typography. */
const FORBIDDEN_PRIMARY = [/text-\[(9|10|11)px\]/, /\bsize=\{(9|10|11|12|13)\}/];
function walk(dir: string, out: string[] = []): string[] {
for (const entry of readdirSync(dir)) {
const path = join(dir, entry);
if (statSync(path).isDirectory()) {
walk(path, out);
} else if (/\.tsx$/.test(entry) && !/\.test\.tsx$/.test(entry)) {
out.push(path);
}
}
return out;
}
describe("ui scale guard — primary shell surfaces", () => {
const shellFiles = walk(SHELL_ROOT);
it("has shell files to scan", () => {
expect(shellFiles.length).toBeGreaterThan(5);
});
for (const file of shellFiles) {
const rel = file.replace(`${SHELL_ROOT}/`, "");
it(`${rel} avoids ultra-small primary UI classes`, () => {
const content = readFileSync(file, "utf8");
for (const pattern of FORBIDDEN_PRIMARY) {
expect(content, pattern.toString()).not.toMatch(pattern);
}
});
}
});