import { readFileSync } from 'node:fs';
import { resolve } from 'node:path';
import { describe, expect, it } from 'vitest';
import indexHtml from '../index.html?raw';
const publicFile = (name: string) => readFileSync(resolve(import.meta.dirname, '../public', name));
/** Breite, Höhe und Farbtyp aus dem IHDR-Block eines PNG (Farbtyp 2 = RGB ohne Alphakanal, 6 = RGBA). */
function pngInfo(buf: Buffer) {
expect(buf.subarray(0, 8).toString('hex')).toBe('89504e470d0a1a0a');
expect(buf.subarray(12, 16).toString('ascii')).toBe('IHDR');
return { width: buf.readUInt32BE(16), height: buf.readUInt32BE(20), colorType: buf[25] };
}
describe('Name und Kopfbereich', () => {
it('Titel und Meta-Angaben nennen AirCard-IOS', () => {
expect(indexHtml).toContain('
AirCard-IOS – Kartenmotiv gestalten');
expect(indexHtml).toContain('');
expect(indexHtml).toContain('');
});
it('Icon-Links: SVG, 32-px-PNG, Apple-Touch-Icon', () => {
expect(indexHtml).toContain('');
expect(indexHtml).toContain('');
expect(indexHtml).toContain('');
});
it('Kopfzeile: dekoratives Logo (28 x 28) links vom Namen, beides im Markenlink', () => {
expect(indexHtml).toContain(
'
AirCard-IOS',
);
});
it('Fußzeilen-Hinweis bleibt unverändert', () => {
expect(indexHtml).toContain(
'Inoffizielles Hobbyprojekt. Keine Verbindung zu Apple, Visa, Mastercard, UnionPay, American Express, JCB oder Discover. Alle Marken gehören ihren Inhabern.',
);
});
});
describe('Icon-Dateien', () => {
it('favicon-32.png ist 32 x 32', () => {
expect(pngInfo(publicFile('favicon-32.png'))).toMatchObject({ width: 32, height: 32 });
});
it('apple-touch-icon.png ist 180 x 180 und deckend (RGB ohne Alphakanal, kein transparenter Rand)', () => {
expect(pngInfo(publicFile('apple-touch-icon.png'))).toEqual({ width: 180, height: 180, colorType: 2 });
});
});