import assert from 'node:assert/strict'; import { readdirSync, readFileSync } from 'node:fs'; import { test } from 'node:test'; import { fileURLToPath } from 'node:url'; import { loadContext, PUBLIC_DIR } from './helpers.js'; import { README, withIconList } from '../scripts/icons.mjs'; import { allIconKeys, assetsSkeleton, iconGroups, THEME_IDS } from '../scripts/icon-keys.js'; const ctx = loadContext(); test('the icon list in the README is up to date (run: npm run icons -- --write)', () => { const readme = readFileSync(README, 'utf8').replaceAll('\r\n', '\n'); assert.equal(readme, withIconList(readme, ctx)); }); test('the README lists every single icon key, once per theme row', () => { const readme = readFileSync(README, 'utf8'); const keys = allIconKeys(ctx); assert.equal(new Set(keys).size, keys.length, 'icon keys are unique'); for (const key of keys) assert.ok(readme.includes(`| \`${key}\` |`), key); }); test('every theme names every themed icon (nothing falls back to a raw key)', () => { const full = readFileSync(README, 'utf8'); const generated = full.slice(full.indexOf('