Files
hermes-ui/tests/client/pwa-metadata.test.ts
T
toor c50a6f63d9
Build / build (push) Canceled after 0s
Playwright / e2e (push) Canceled after 0s
fix: use app icon across browser and chat
2026-11-05 12:01:20 +08:00

40 lines
1.6 KiB
TypeScript

import { readFileSync } from 'fs'
import { describe, expect, it } from 'vitest'
describe('PWA metadata', () => {
it('links manifest and touch icon from the client shell', () => {
const html = readFileSync('packages/client/index.html', 'utf8')
expect(html).toContain('rel="icon" type="image/png" href="/app-logo.png"')
expect(html).toContain('rel="manifest" href="/manifest.webmanifest"')
expect(html).toContain('rel="apple-touch-icon" href="/app-logo.png"')
expect(html).toContain('name="apple-mobile-web-app-title" content="hermes-ui"')
})
it('ships a standalone web manifest with the Hermes icon', () => {
const manifest = JSON.parse(readFileSync('packages/client/public/manifest.webmanifest', 'utf8'))
expect(manifest.name).toBe('hermes-ui')
expect(manifest.display).toBe('standalone')
expect(manifest.start_url).toBe('/#/hermes/chat')
expect(manifest.icons).toEqual(expect.arrayContaining([
expect.objectContaining({
src: '/app-logo.png',
type: 'image/png',
purpose: 'any',
}),
]))
})
it('ships matching application and legacy icon assets', () => {
const logo = readFileSync('packages/client/public/app-logo.png')
const legacyLogo = readFileSync('packages/client/public/logo.png')
const favicon = readFileSync('packages/client/public/favicon.ico')
expect(legacyLogo.equals(logo)).toBe(true)
expect(logo.readUInt32BE(16)).toBe(512)
expect(logo.readUInt32BE(20)).toBe(512)
expect(favicon.readUInt16LE(2)).toBe(1)
expect(favicon.subarray(22, 30)).toEqual(Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]))
})
})