From 94dfc1be1e265943c2b06370808fcd818d8724f7 Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Mon, 13 Apr 2026 17:37:37 +0200 Subject: [PATCH] Add test for NPC foundation entity migration with default collider settings --- .../serialization/scene-document-json.test.ts | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/tests/serialization/scene-document-json.test.ts b/tests/serialization/scene-document-json.test.ts index 85e3a065..aa09b95d 100644 --- a/tests/serialization/scene-document-json.test.ts +++ b/tests/serialization/scene-document-json.test.ts @@ -1658,6 +1658,51 @@ describe("scene document JSON", () => { expect(Object.keys(migratedDocument.materials)).toEqual(STARTER_MATERIAL_LIBRARY.map((material) => material.id)); }); + it("migrates NPC foundation entities to include default collider settings", () => { + const migratedDocument = migrateSceneDocument({ + version: NPC_ENTITY_FOUNDATION_SCENE_DOCUMENT_VERSION, + name: "NPC Collider Migration", + world: createEmptySceneDocument().world, + materials: createEmptySceneDocument().materials, + textures: {}, + assets: {}, + brushes: {}, + modelInstances: {}, + entities: { + "entity-npc-guide": { + id: "entity-npc-guide", + kind: "npc", + position: { + x: 1, + y: 0, + z: 2 + }, + visible: true, + enabled: true, + actorId: "actor-town-guide", + yawDegrees: 30, + modelAssetId: null + } + }, + interactionLinks: {} + }); + + expect(migratedDocument.version).toBe(SCENE_DOCUMENT_VERSION); + expect(migratedDocument.entities["entity-npc-guide"]).toEqual( + createNpcEntity({ + id: "entity-npc-guide", + actorId: "actor-town-guide", + position: { + x: 1, + y: 0, + z: 2 + }, + yawDegrees: 30, + modelAssetId: null + }) + ); + }); + it("migrates slice 3.0 documents to the current schema version without changing empty asset collections", () => { const migratedDocument = migrateSceneDocument({ version: MODEL_ASSET_PIPELINE_SCENE_DOCUMENT_VERSION,