import test from "node:test"; import assert from "node:assert/strict"; import { readFileSync, readdirSync } from "node:fs"; import { createHash } from "node:crypto"; import { load } from "cheerio"; const html = readFileSync("public/mindco.html", "utf8"); const $ = load(html); const css = readFileSync("public/mindco.css", "utf8"); const js = readFileSync("public/mindco.js", "utf8"); test("mindco is a standalone noindex experiment with a real services link", () => { assert.equal($('meta[name="robots"]').attr("content"), "noindex, nofollow"); assert.equal($("h1").attr("aria-label"), "mindco"); assert.equal($(".tagline").attr("href"), "https://cameron.stream/services"); assert.equal($(".tagline span").text(), "Make AI simple"); assert.equal($("nav, img, iframe").length, 0); assert.match(html, /not a claim of name availability/); assert.match(readFileSync("src/index.tsx", "utf8"), /c.header\("X-Robots-Tag", "noindex, nofollow"\)/); }); test("palette controls are labeled, copyable, fixed-hue and geometry-preserving", () => { for (const id of ["mode", "chroma", "lightness"]) { assert.equal($(`label[for="${id}"]`).length, 1); assert.equal($(`#${id}`).length, 1); } for (const name of ["clay", "ochre", "patina"]) { assert.equal($(`#${name}-value[readonly]`).length, 1); } assert.equal($("#copy-status").attr("role"), "status"); assert.match(js, /const hues = \[35, 85, 185\]/); assert.match(js, /o.style.fill = paint/); assert.match(js, /o.style.stroke = paint/); assert.doesNotMatch(css, /background-clip|text-stroke:\s*0/); assert.match(css, /prefers-reduced-motion/); }); test("only the byte-identical upstream variable Comfortaa and its OFL are distributed", () => { const directory = "public/fonts/comfortaa"; assert.deepEqual(readdirSync(directory).sort(), ["Comfortaa.ttf", "OFL.txt"]); assert.equal(createHash("sha256").update(readFileSync(`${directory}/Comfortaa.ttf`)).digest("hex"), "0fc3f45dc48b614db9c39181502544b37217ecbf8bee2fb35886992bc96c5bd3"); const license = readFileSync(`${directory}/OFL.txt`, "utf8"); assert.match(license, /Copyright 2011 The Comfortaa Project Authors/); assert.match(license, /Reserved Font Name "Comfortaa"/); assert.match(license, /SIL OPEN FONT LICENSE Version 1.1/); assert.match(html, /font license applies to the font, not this wordmark or site code/); });