Spaces:
Runtime error
Runtime error
| import { readFileSync } from 'node:fs' | |
| import { resolve } from 'node:path' | |
| import { describe, it, expect } from 'vitest' | |
| const html = readFileSync(resolve(__dirname, '../../index.html'), 'utf-8') | |
| function findMeta(name: string): string | null { | |
| const match = html.match(new RegExp(`<meta\\s+name="${name}"\\s+content="([^"]*)"`, 'i')) | |
| return match?.[1] ?? null | |
| } | |
| describe('viewport meta', () => { | |
| const content = findMeta('viewport') | |
| it('has viewport meta', () => { | |
| expect(content).not.toBeNull() | |
| }) | |
| it('has width=device-width', () => { | |
| expect(content).toContain('width=device-width') | |
| }) | |
| it('has viewport-fit=cover', () => { | |
| expect(content).toContain('viewport-fit=cover') | |
| }) | |
| it('has user-scalable=no', () => { | |
| expect(content).toContain('user-scalable=no') | |
| }) | |
| it('has maximum-scale=1.0', () => { | |
| expect(content).toContain('maximum-scale=1.0') | |
| }) | |
| }) | |
| describe('theme-color meta', () => { | |
| it('has theme-color meta tag', () => { | |
| expect(findMeta('theme-color')).not.toBeNull() | |
| }) | |
| }) | |