import { test, expect } from 'vitest';
import fs from 'fs';
import path from 'path';
import sharp from 'sharp';
import { fileURLToPath } from 'url';

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

test('favicon.ico should exist', () => {
	const icoPath = path.join(__dirname, '..', '..', 'static', 'favicon.ico');
	expect(fs.existsSync(icoPath)).toBe(true);
});

test('favicon.ico should be 32x32', async () => {
	const icoPath = path.join(__dirname, '..', '..', 'static', 'favicon.ico');
	const metadata = await sharp(icoPath).metadata();
	expect(metadata.width).toBe(32);
	expect(metadata.height).toBe(32);
});

test('favicon.ico should be valid PNG format', async () => {
	const icoPath = path.join(__dirname, '..', '..', 'static', 'favicon.ico');
	const metadata = await sharp(icoPath).metadata();
	expect(metadata.format).toBe('png');
});
