// The catalog glyphs, byte for byte, plus every glyphFor branch.
import test from "node:test";
import assert from "node:assert/strict";
import { boot, vectors } from "./harness.mjs";
const { lib } = await boot();
const v = vectors("glyphs");
test("the GLYPHS map has the same keys as the TS object", () => {
assert.deepEqual([...lib.glyphKeys()], v.keys);
});
test("every glyph's SVG source is byte-identical", () => {
const map = lib.glyphMap();
for (const k of v.keys) assert.equal(map[k], v.map[k], `glyph ${k}`);
});
test("catalogGlyph: the accent diamond, valid accents and the sage fallback", () => {
for (const [accent, want] of Object.entries(v.accents)) {
assert.equal(lib.catalogGlyph(accent), want, `accent ${JSON.stringify(accent)}`);
}
});
test("glyphFor: override > named glyph > accent diamond, over every case", () => {
v.script.forEach((entry, i) => {
assert.equal(lib.glyphFor(entry), v.out[i], `case ${i}: ${JSON.stringify(entry)}`);
});
});
test("a prototype key falls through to the diamond (the TS quirk, fixed)", () => {
// GLYPHS is a CLJS map here, not a plain object, so "__proto__" has no
// prototype-chain hit — the TS returned Object.prototype and painted
// "[object Object]". The fixture recorded that; the port improves on it.
assert.equal(v.protoQuirk.tsReturnedAString, false, "the fixture must still record the TS quirk");
assert.equal(lib.glyphFor(v.protoQuirk.entry), v.protoQuirk.cljsMustReturn);
});