Skip to content
← Public packages

@kody/mailroom

Offline-first PWA for your Kody mailbox: sent and received threads, copy-prompt for agents, no send.

src/ui/art.node.test.ts

28 lines · 957 B · TypeScript
import assert from 'node:assert/strict'
import test from 'node:test'
import { ART_FILES } from './art-assets.ts'
import { decodeArtBase64 } from './art.ts'

function pngSize(base64: string) {
	const bytes = decodeArtBase64(base64)
	const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength)
	return { width: view.getUint32(16), height: view.getUint32(20) }
}

const expected = {
	'favicon.png': 64,
	'apple-touch-icon.png': 180,
	'pwa-192.png': 192,
	'pwa-512.png': 512,
	'pwa-192-maskable.png': 192,
	'pwa-512-maskable.png': 512,
} as const

test('PWA art is Kody mail-clerk PNG marks at the expected sizes', () => {
	for (const [name, size] of Object.entries(expected)) {
		const file = ART_FILES[name as keyof typeof ART_FILES]
		assert.equal(file.type, 'image/png')
		assert.ok(file.base64.length > 1000, `${name} should be a real illustration, not a stub`)
		assert.deepEqual(pngSize(file.base64), { width: size, height: size })
	}
})