auto: PR for feat/manifest-robots-restore #55
@@ -0,0 +1,39 @@
|
||||
import { describe, it, expect } from 'vitest'
|
||||
import { buildZip } from '@/lib/exporter/zip'
|
||||
import { exportPage } from '@/lib/exporter/html'
|
||||
import { pageSchema, type Page } from '@/lib/schema/page'
|
||||
import { buildExtrasForPage } from '@/lib/exporter/extras'
|
||||
|
||||
function makePage(): Page {
|
||||
return pageSchema.parse({
|
||||
title: 'ZIP Phase5',
|
||||
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('ZIP 검증 Phase5', () => {
|
||||
it('robots.txt 베이스라인과 site.webmanifest JSON 파싱 검증', async () => {
|
||||
const page = makePage()
|
||||
const extras = buildExtrasForPage(page)
|
||||
|
||||
// baseline robots
|
||||
const robots = Buffer.from(extras['robots.txt']).toString('utf8')
|
||||
expect(robots).toContain('User-agent: *')
|
||||
|
||||
// manifest JSON parseable
|
||||
const manifestStr = Buffer.from(extras['site.webmanifest']).toString('utf8')
|
||||
const manifest = JSON.parse(manifestStr)
|
||||
expect(manifest && typeof manifest === 'object').toBe(true)
|
||||
expect(manifest.start_url).toBeDefined()
|
||||
expect(manifest.display).toBeDefined()
|
||||
|
||||
// ZIP build should succeed
|
||||
const out = exportPage(page)
|
||||
const zipBytes = await buildZip({ html: out.html, css: out.css, js: out.js, assets: {}, extras })
|
||||
expect(zipBytes.byteLength).toBeGreaterThan(0)
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user