import { test } from "node:test"; import assert from "node:assert/strict"; import { buildSiteDescriptor } from "./siteDescriptor"; import { parseSite } from "./siteSchema"; import type { Manifest } from "./manifest"; import { ACCENTS } from "./brand"; // The public /site.json is read by OTHER hubs, which draw `accent` as a colour. // A site.json may now store an accent id; the descriptor must still publish a // hex (lib/accent.ts accentHex). const MANIFEST = { version: 3, totalCount: 0, pageSize: 100, pageCount: 0, generatedAt: "2026-09-25T00:00:00.000Z", channels: [], } as Manifest; function descriptorFor(raw: Record) { return buildSiteDescriptor(parseSite("s", raw), MANIFEST, [], { pwa: false }); } test("an accent id is published as its on-dark hex", () => { assert.equal(descriptorFor({ accent: "brass" }).accent, ACCENTS.brass.onDark); assert.equal(descriptorFor({ accent: "sakura" }).accent, "#ee8fb5"); }); test("a custom hex is published as stored; no accent publishes no key", () => { assert.equal(descriptorFor({ accent: "#CC3366" }).accent, "#cc3366"); assert.equal("accent" in descriptorFor({}), false); assert.equal("accent" in descriptorFor({ accent: "gold" }), false); }); test("the wordmark lead is not part of the public descriptor", () => { const d = descriptorFor({ headerTitle: "Jeralyzer", wordmarkLead: "Jer" }); assert.equal("wordmarkLead" in d, false); assert.equal(d.headerTitle, "Jeralyzer"); });