/** RFC-0026: the curated set, its generated data and the inline markup. */ import { readFileSync } from "node:fs"; import path from "node:path"; import { fileURLToPath } from "node:url"; import { describe, expect, it } from "vitest"; import { ICON_WEIGHTS as GENERATED, iconsData } from "../scripts/gen-icons.ts"; import { defineIconSet, ICON_GROUPS, ICON_NAMES, ICON_WEIGHTS, IconSetError, isIconName, renderIcon, } from "../src/icons.ts"; describe("icons (RFC-0026)", () => { it("keeps every weight's generated data in step with the list and the sources", () => { expect([...GENERATED]).toEqual([...ICON_WEIGHTS]); for (const w of GENERATED) expect( readFileSync( path.join(path.dirname(fileURLToPath(import.meta.url)), `../src/generated/icons-${w}.ts`), "utf8", ), ).toBe(iconsData(w)); }); it("names every SocialLink network and groups every name once", () => { const grouped = Object.values(ICON_GROUPS).flat(); expect(new Set(grouped).size).toBe(grouped.length); expect([...grouped].sort()).toEqual([...ICON_NAMES].sort()); expect(ICON_GROUPS.social).toEqual([ "x", "bluesky", "mastodon", "github", "linkedin", "instagram", "facebook", "youtube", "tiktok", "threads", "rss", "email", ]); expect(ICON_NAMES.length).toBeGreaterThanOrEqual(80); expect(ICON_NAMES.length).toBeLessThanOrEqual(120); }); it("draws decorative icons, labelled ones, mirrored arrows, and nothing for unknown names", () => { expect(renderIcon("check")).toMatch( /^