import { describe, it, expect } from 'vitest' import { exportPage } from '@/lib/exporter/html' import { pageSchema, type Page } from '@/lib/schema/page' function makePage(overrides: Partial = {}): Page { const base: Page = { title: 'CTA Edge', locale: 'en', theme: { primaryColor: '#2563eb', fontFamily: 'Inter' }, sections: [ { type: 'cta', props: { text: ' ', href: '#' } }, { type: 'features', props: { items: ['One'] } }, ] as Page['sections'], form: { actionUrl: '', fields: [], spamProtection: { honeypotFieldName: '_hp', minSubmitSeconds: 2 } }, analytics: { ga4MeasurementId: '', metaPixelId: '', customHeadHtml: '' }, seo: { title: 't', description: 'd' }, } return pageSchema.parse({ ...base, ...overrides }) } describe('Exporter - CTA edge cases', () => { it('drops CTA section when text is whitespace-only', () => { const out = exportPage(makePage()) expect(out.html).not.toContain('
{ const out = exportPage(makePage({ sections: [ { type: 'cta', props: { text: ' Buy Now ', href: '#' } } ] as Page['sections'] })) expect(out.html).toContain('Buy Now') }) })