import { describe, expect, test } from 'vitest' import { exportPage } from './html' import { pageSchema, type Page } from '@/lib/schema/page' describe('Exporter - OG image meta', () => { test('includes og:image meta when seo.ogImage is provided', () => { const page: Page = pageSchema.parse({ title: 'T', locale: 'en', theme: { primaryColor: '#000000', fontFamily: 'Inter' }, sections: [], form: { actionUrl: '', fields: [], spamProtection: { honeypotFieldName: '_hp', minSubmitSeconds: 2 } }, analytics: { ga4MeasurementId: '', metaPixelId: '', customHeadHtml: '' }, seo: { title: 'SEO', description: 'Desc', ogImage: 'https://example.com/og.png' }, }) const out = exportPage(page) expect(out.html).toContain('') }) test('omits og:image meta when seo.ogImage is empty', () => { const page: Page = pageSchema.parse({ title: 'T', locale: 'en', theme: { primaryColor: '#000000', fontFamily: 'Inter' }, sections: [], form: { actionUrl: '', fields: [], spamProtection: { honeypotFieldName: '_hp', minSubmitSeconds: 2 } }, analytics: { ga4MeasurementId: '', metaPixelId: '', customHeadHtml: '' }, seo: { title: 'SEO', description: 'Desc' }, }) const out = exportPage(page) expect(out.html).not.toContain('og:image') }) })