import { describe, expect, it } from 'vitest'; import { serializedToPackage } from './package.js'; describe('serializedToPackage', () => { it('converts plain-object maps to Map instances', () => { const serialized = { meta: { id: 'harbor' }, parts: { 'token#wood': { type: 'token', id: 'wood' } }, surfaces: { 'board#harbor': { type: 'board', id: 'harbor', layout: [] } }, setups: { 'game#main': { type: 'game', id: 'main', setup: {} } }, }; const pkg = serializedToPackage(serialized); expect(pkg.meta.id).toBe('harbor'); expect(pkg.parts).toBeInstanceOf(Map); expect(pkg.parts.get('token#wood')).toEqual({ type: 'token', id: 'wood' }); expect(pkg.surfaces.get('board#harbor')).toMatchObject({ type: 'board' }); expect(pkg.setups.get('game#main')).toMatchObject({ type: 'game' }); }); });