feat: add asset import services

This commit is contained in:
Simo committed 2026-07-12 19:12:25 +02:00
1 parent 4b596226e0
commit 3497df9dfd
46 files changed
+5383

No files matched your search

+47
View File
@@ -0,0 +1,47 @@
// @vitest-environment node
import { describe, expect, it, vi } from 'vitest'
vi.mock('@/lib/prisma', () => ({
prisma: {},
}))
vi.mock('@/lib/services/furni-data', () => ({
appendFurniEntry: vi.fn(),
buildFurniEntry: vi.fn(),
removeFurniEntry: vi.fn(),
}))
vi.mock('@/lib/services/habbo-furnidata-cache', () => ({
lookupHabboIt: vi.fn(),
}))
vi.mock('@/lib/services/import/core/download', () => ({
downloadFile: vi.fn(),
validatePngBytes: vi.fn(),
validateSwfBytes: vi.fn(),
}))
vi.mock('@/lib/services/swf-to-nitro', () => ({
convertSwfToNitro: vi.fn(),
extractIconFromSwf: vi.fn(),
}))
import { buildItemsBaseEnrichmentUpdate } from './furni-import'
describe('buildItemsBaseEnrichmentUpdate', () => {
it('only updates columns present in the live Arcturus items_base schema', () => {
const update = buildItemsBaseEnrichmentUpdate({
id: 123,
dims: { x: 2, y: 3, z: 1.5 },
cansiton: true,
canlayon: false,
canstandon: true,
allowStack: '1',
interactionType: 'default',
})
expect(update.sql).not.toContain('specialtype')
expect(update.values).toEqual([2, 3, 1.5, '1', '0', '1', '1', 'default', 123])
})
})