import assert from 'node:assert/strict' import { readFile } from 'node:fs/promises' import { createRequire } from 'node:module' import path from 'node:path' import { fileURLToPath } from 'node:url' import { faviconTargets } from './favicon-targets.mjs' const root = fileURLToPath(new URL('../', import.meta.url)) const sharp = createRequire(path.join(root, 'apps/kb/package.json'))('sharp') for (const [variant, directory] of faviconTargets) { const file = (name) => path.join(root, directory, name) const svg = await readFile(path.join(root, `assets/favicons/${variant}.svg`), 'utf8') assert.match(svg, /width="512" height="512"/) assert.match(svg, /M0 153\.6C0 99\.835/) if (variant === 'local') { assert.doesNotMatch(svg, /stroke-dasharray|stroke-width/) assert.match(svg, / 0) } } console.log(`Validated ${faviconTargets.length} icon sets, ICO entries and manifest base paths.`)