import { describe, it, expect } from 'vitest' import { exportPage } from '@/lib/exporter/html' import { pageSchema, type Page } from '@/lib/schema/page' function makePage(): Page { return pageSchema.parse({ title: 'SEO/Perf', locale: 'en', theme: { primaryColor: '#0ea5e9', fontFamily: 'Inter' }, sections: [ { type: 'hero', props: { heading: 'Welcome', subheading: 'Sub', imageUrl: 'https://img.example/hero.png' } }, ], form: { actionUrl: '', fields: [], spamProtection: { honeypotFieldName: '_hp', minSubmitSeconds: 2 } }, seo: { title: 'SEO', description: 'Desc' }, }) } describe('Exporter - small SEO/Perf improvements', () => { it('includes canonical link and dark mode tokens; hero image lazy/async', () => { const out = exportPage(makePage()) const html = out.html const css = out.css // canonical link present in head expect(html).toMatch(/]+rel="canonical"/) // hero image has loading/decoding attributes expect(html).toMatch(/]*loading="lazy"/) expect(html).toMatch(/]*decoding="async"/) // dark mode media query token exists expect(css).toMatch(/@media \(prefers-color-scheme: dark\)/) }) })