29 lines
1.3 KiB
TypeScript
29 lines
1.3 KiB
TypeScript
import { describe, it, expect } from 'vitest'
|
|
import JSZip from 'jszip'
|
|
import { buildZip } from '@/lib/exporter/zip'
|
|
|
|
describe('Export ZIP 메타 보존 검증', () => {
|
|
it('index.html의 SEO/OG/Analytics 메타가 그대로 보존된다', async () => {
|
|
const html = `<!DOCTYPE html><html><head>
|
|
<meta charset="utf-8" />
|
|
<link rel="canonical" href="/" />
|
|
<meta name="description" content="desc" />
|
|
<meta property="og:title" content="OT" />
|
|
<meta property="og:description" content="OD" />
|
|
<script>window.dataLayer=[];function gtag(){dataLayer.push(arguments);}gtag('js',new Date());</script>
|
|
</head><body>ok</body></html>`
|
|
const css = 'body{color:#222}'
|
|
const js = 'console.log("ok")'
|
|
|
|
const zipBytes = await buildZip({ html, css, js, assets: {} })
|
|
const zip = await JSZip.loadAsync(zipBytes)
|
|
const htmlContent = await zip.files['index.html'].async('string')
|
|
|
|
expect(htmlContent).toMatch(/<link rel="canonical" href="\//)
|
|
expect(htmlContent).toMatch(/<meta name="description" content="desc"/)
|
|
expect(htmlContent).toMatch(/<meta property="og:title" content="OT"/)
|
|
expect(htmlContent).toMatch(/<meta property="og:description" content="OD"/)
|
|
expect(htmlContent).toMatch(/window\.dataLayer=\[\];/)
|
|
})
|
|
})
|