AT Mot — a bilingual (EN/FR) daily word game native to the AT Protocol.
0

Configure Feed

Select the types of activity you want to include in your feed.

Harden PWA tests: guard icon opacity, PNG signature, status-bar tag

+16 -1
+5 -1
DECISIONS.md
··· 122 122 Android manual "Add to Home Screen" both work from the manifest alone; the 123 123 proactive Android install banner (which needs a service worker) is forgone on 124 124 purpose. Loading speed is unchanged (CDN + ~94 KB bundle) with no new failure 125 - modes. 125 + modes. The regression guard `tests/pwa.test.ts` uses `node:*` imports, so 126 + `"node"` was added to the shared `tsconfig.json` `types` allowlist — a 127 + conscious trade-off: Node globals become visible to `src/` typechecking, but 128 + `noEmit` + Vite bundling mean it can't affect runtime; narrow later by giving 129 + `tests` its own node-typed project if that boundary is wanted.
+11
tests/pwa.test.ts
··· 6 6 const root = fileURLToPath(new URL('..', import.meta.url)); 7 7 const p = (rel: string) => root + rel; 8 8 9 + const SIG = Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]); 10 + 9 11 /** Read width/height from a PNG's IHDR chunk (bytes 16–24, big-endian). */ 10 12 function pngSize(path: string): { width: number; height: number } { 11 13 const buf = readFileSync(path); 14 + if (!buf.subarray(0, 8).equals(SIG)) throw new Error(`${path} is not a PNG`); 12 15 return { width: buf.readUInt32BE(16), height: buf.readUInt32BE(20) }; 16 + } 17 + 18 + /** PNG IHDR color type (byte 25): 2 = RGB (opaque), 6 = RGBA. */ 19 + function pngColorType(path: string): number { 20 + return readFileSync(path).readUInt8(25); 13 21 } 14 22 15 23 describe('PWA icons', () => { ··· 25 33 const { width, height } = pngSize(p(rel)); 26 34 expect(width).toBe(size); 27 35 expect(height).toBe(size); 36 + // Icons must be opaque (flattened onto #0e1116), not RGBA. 37 + expect(pngColorType(p(rel)), `${rel} has an alpha channel`).toBe(2); 28 38 }); 29 39 } 30 40 }); ··· 64 74 it('declares mobile-web-app capability and iOS app title', () => { 65 75 expect(html).toContain('name="mobile-web-app-capable"'); 66 76 expect(html).toContain('name="apple-mobile-web-app-title"'); 77 + expect(html).toContain('name="apple-mobile-web-app-status-bar-style"'); 67 78 }); 68 79 });