import { describe, expect, test } from 'vitest' import { exportPage } from './html' import { pageSchema, type Page } from '@/lib/schema/page' function makePage(): Page { return pageSchema.parse({ title: 'My Landing', locale: 'en', theme: { primaryColor: '#222222', fontFamily: 'Inter' }, sections: [ { type: 'hero', props: { heading: 'Welcome', subheading: 'Sub', imageUrl: 'https://example.com/hero.png' } }, { type: 'features', props: { items: ['Fast', 'Reliable'] } }, { type: 'testimonials', props: { items: [{ author: 'Jane', quote: 'Great' }] } }, { type: 'faq', props: { items: [{ q: 'Q1', a: 'A1' }] } }, { type: 'cta', props: { text: 'Start', href: '#' } }, ] as Page['sections'], form: { actionUrl: '', fields: [], spamProtection: { honeypotFieldName: '_hp', minSubmitSeconds: 2 } }, analytics: { ga4MeasurementId: '', metaPixelId: '', customHeadHtml: '' }, seo: { title: 'SEO', description: 'Desc' }, }) } describe('Exporter heading levels', () => { test('hero uses h1, sections use h2, faq questions use h3', () => { const out = exportPage(makePage()) // hero h1 expect(out.html).toMatch(/
Welcome<\/h1>/) // features/testimonials/faq/cta use h2 for section titles expect(out.html).toContain('

') expect(out.html).toContain('

') expect(out.html).toContain('

') expect(out.html).toContain('

') // faq item question headings h3 expect(out.html).toMatch(/
Q1<\/h3>/) }) })