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: 'Escape Regression', locale: 'en', theme: { primaryColor: '#0ea5e9', fontFamily: 'Inter' }, sections: [ { type: 'features', props: { items: ['F<&>"', 'Safe'] } }, { type: 'faq', props: { items: [{ q: 'Q<&>"', a: 'A<&>"' }] } }, ], form: { actionUrl: '', fields: [], spamProtection: { honeypotFieldName: '_hp', minSubmitSeconds: 2 } }, seo: { title: 'SEO', description: 'Desc' }, }) } describe('Exporter - HTML escape regression (Features/FAQ)', () => { it('escapes HTML special characters in features items', () => { const out = exportPage(makePage()) const html = out.html // feature item should contain escaped characters < & > " expect(html).toContain('
  • F<&>"
  • ') }) it('escapes HTML special characters in faq q/a', () => { const out = exportPage(makePage()) const html = out.html expect(html).toContain('

    Q<&>"

    ') expect(html).toContain('

    A<&>"

    ') }) })