test: add MVP QA gate

This commit is contained in:
vince 2026-06-18 19:41:29 +02:00
parent af09f705b1
commit 081d6085a5
10 changed files with 413 additions and 7 deletions

View file

@ -0,0 +1,47 @@
import { readdirSync, readFileSync, statSync } from "node:fs";
import { join } from "node:path";
import { describe, expect, test } from "vitest";
const presentationRoots = [
join(process.cwd(), "src", "lib", "ui"),
join(process.cwd(), "src", "routes"),
];
const forbiddenTerms = [
"dimensionlab",
"dimension lab",
"vaultwarden",
"forgejo",
"grafana",
"uptime kuma",
"prometheus",
"backrest",
"open webui",
"comfyui",
"adminer",
"cockpit",
"ollama",
"dimensionlab.net",
];
describe("presentation content boundary", () => {
test("keeps environment-specific content out of route and UI implementation", () => {
const source = presentationRoots.map(readPresentationSource).join("\n").toLowerCase();
expect(forbiddenTerms.filter((term) => source.includes(term))).toEqual([]);
});
});
function readPresentationSource(path: string): string {
const stats = statSync(path);
if (stats.isFile()) {
if (path.endsWith(".test.ts")) return "";
if (path.includes(`${join("src", "lib", "ui", "stories")}${"/"}`)) return "";
if (!/\.(svelte|ts|css)$/.test(path)) return "";
return readFileSync(path, "utf8");
}
return readdirSync(path)
.map((entry) => readPresentationSource(join(path, entry)))
.join("\n");
}