import assert from 'node:assert/strict' import { readFileSync } from 'node:fs' import { test } from 'node:test' import { APP_MARK_SVG, renderShell } from './ui.ts' const pub = (f: string) => new URL(`../../public/${f}`, import.meta.url) test('favicon.svg is the same self-contained mark as the rail logo', () => { const fav = readFileSync(pub('favicon.svg'), 'utf8').trim() assert.match(fav, /viewBox="0 0 32 32"/) assert.doesNotMatch(fav, /https?:\/\/(?!www\.w3\.org)/, 'no external references') const norm = (s: string) => s.replace(/ xmlns="[^"]+"/, '').replace(/ aria-hidden="true"/, '').replace(/kf-(favicon|mark)-grad/g, 'G') assert.equal(norm(fav), norm(APP_MARK_SVG)) }) test('apple-touch-icon.png is a 180x180 PNG', () => { const png = readFileSync(pub('apple-touch-icon.png')) assert.equal(png.subarray(1, 4).toString('latin1'), 'PNG') assert.equal(png.readUInt32BE(16), 180) assert.equal(png.readUInt32BE(20), 180) }) test('shell head links the icons under the app base path', () => { const html = renderShell({ basePath: '/kody-factory', view: 'overview', title: 'Overview' }) assert.ok(html.includes('')) assert.ok(html.includes('')) assert.ok(html.includes('')) assert.equal(html.split('id="kf-mark-grad"').length - 1, 1, 'gradient id is unique on the page') })