import assert from 'node:assert/strict'; import { readFile } from 'node:fs/promises'; import test from 'node:test'; test('PWA icons include a compact adaptive icon', async () => { const manifest = JSON.parse(await readFile(new URL('../public/manifest.webmanifest', import.meta.url), 'utf8')); for (const size of ['192x192', '512x512']) { assert.ok(manifest.icons.some(icon => icon.sizes === size && (icon.purpose ?? 'any').split(/\s+/).includes('any'))); } const maskable = manifest.icons.filter(icon => (icon.purpose ?? 'any').split(/\s+/).includes('maskable')); assert.equal(maskable.length, 1); assert.equal(maskable[0].sizes, '512x512'); assert.equal(maskable[0].type, 'image/png'); const image = await readFile(new URL(`../public${maskable[0].src}`, import.meta.url)); assert.ok(image.length <= 32 * 1024); assert.equal(image.readUInt32BE(16), 512); assert.equal(image.readUInt32BE(20), 512); });