The SVG media query alone fixes the dark-mode icon for every SVG-capable browser (Chrome, Edge, Firefox, Safari 26+); the PNG only served Safari versions before 26, which is a shrinking legacy audience not worth a second asset, its manifest/link declarations, and the extra test surface. index.html and the manifest are back to the single SVG icon.
36 lines
1.3 KiB
TypeScript
36 lines
1.3 KiB
TypeScript
import { readFile } from 'node:fs/promises'
|
|
import { fileURLToPath } from 'node:url'
|
|
import { join } from 'node:path'
|
|
import { expect, it } from 'vitest'
|
|
|
|
const DIST_ROOT = fileURLToPath(new URL('../dist', import.meta.url))
|
|
|
|
it('ships install metadata with the built web application', async () => {
|
|
const index = await readFile(join(DIST_ROOT, 'index.html'), 'utf8')
|
|
expect(index).toContain('<link rel="manifest" href="/manifest.webmanifest" />')
|
|
|
|
const manifest: unknown = JSON.parse(await readFile(join(DIST_ROOT, 'manifest.webmanifest'), 'utf8'))
|
|
expect(manifest).toEqual({
|
|
id: '/',
|
|
name: 'DeepSeek Harness',
|
|
short_name: 'DSH',
|
|
start_url: '/',
|
|
scope: '/',
|
|
display: 'fullscreen',
|
|
icons: [{
|
|
src: '/favicon.svg',
|
|
sizes: 'any',
|
|
type: 'image/svg+xml',
|
|
purpose: 'any',
|
|
}],
|
|
})
|
|
})
|
|
|
|
it('ships a favicon that switches to a light mark under dark color scheme', async () => {
|
|
const favicon = await readFile(join(DIST_ROOT, 'favicon.svg'), 'utf8')
|
|
// The light fill must live inside the dark-scheme media query, so the icon
|
|
// stays black in light mode and only turns white under a dark scheme.
|
|
expect(favicon).toMatch(/@media \(prefers-color-scheme: dark\)\s*{\s*path\s*{[^}]*fill:\s*#fff/i)
|
|
expect(favicon).toContain('fill="#000"')
|
|
})
|