30 lines
1.1 KiB
TypeScript
30 lines
1.1 KiB
TypeScript
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: 'Font Opt',
|
|
locale: 'en',
|
|
theme: { primaryColor: '#2563eb', fontFamily: 'Inter' },
|
|
sections: [ { type: 'hero', props: { heading: 'Hello', subheading: 'World', imageUrl: 'https://img/h.png' } } ],
|
|
form: { actionUrl: '', fields: [], spamProtection: { honeypotFieldName: '_hp', minSubmitSeconds: 2 } },
|
|
seo: { title: 't', description: 'd' },
|
|
})
|
|
}
|
|
|
|
describe('폰트 최적화', () => {
|
|
it('head에 Google Fonts preconnect 링크가 포함된다', () => {
|
|
const page = makePage()
|
|
const out = exportPage(page)
|
|
expect(out.html).toContain('<link rel="preconnect" href="https://fonts.googleapis.com"')
|
|
expect(out.html).toContain('<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin')
|
|
})
|
|
|
|
it('CSS에 system-ui 폴백이 포함된다', () => {
|
|
const page = makePage()
|
|
const out = exportPage(page)
|
|
expect(out.css).toMatch(/font-family:[^;]*system-ui/i)
|
|
})
|
|
})
|