fix(ci): 누락 파일 추가 및 AssetManager 경로 전략 변경사항 포함
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import { describe, it, expect } from 'vitest'
|
||||
import { AssetManager } from '@/lib/assets/assetManager'
|
||||
import { buildAssetsIndex } from '@/lib/exporter/assets.index'
|
||||
|
||||
function u8(n: number): Uint8Array { const a = new Uint8Array(n); for (let i=0;i<n;i++) a[i]=i&0xff; return a }
|
||||
|
||||
describe('Assets index builder', () => {
|
||||
it('groups assets by mime into images/fonts/other and lists zipPath', async () => {
|
||||
const am = new AssetManager({ maxBytes: 1024*1024, allowedExts: ['png','woff2','txt'] })
|
||||
await am.add({ name: 'a.png', type: 'image/png', bytes: u8(4) })
|
||||
await am.add({ name: 'b.woff2', type: 'font/woff2', bytes: u8(6) })
|
||||
await am.add({ name: 'c.txt', type: 'text/plain', bytes: u8(2) })
|
||||
const bytes = buildAssetsIndex(am)
|
||||
const obj = JSON.parse(new TextDecoder().decode(bytes)) as { images: string[]; fonts: string[]; other: string[] }
|
||||
expect(obj.images.length).toBe(1)
|
||||
expect(obj.fonts.length).toBe(1)
|
||||
expect(obj.other.length).toBe(1)
|
||||
expect(obj.images[0]).toMatch(/^assets\/[0-9a-f]{8}\.png$/)
|
||||
expect(obj.fonts[0]).toMatch(/^assets\/[0-9a-f]{8}\.woff2$/)
|
||||
expect(obj.other[0]).toMatch(/^assets\/[0-9a-f]{8}\.txt$/)
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user