From a5a1b4d68c0d52b204a1d6005078d5cb63fba2de Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Mon, 13 Apr 2026 23:56:08 +0200 Subject: [PATCH] Add test for migrating pre-presence NPC entities to always-authored presence --- .../serialization/scene-document-json.test.ts | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/tests/serialization/scene-document-json.test.ts b/tests/serialization/scene-document-json.test.ts index 17f99f83..11d8a82b 100644 --- a/tests/serialization/scene-document-json.test.ts +++ b/tests/serialization/scene-document-json.test.ts @@ -1711,6 +1711,55 @@ describe("scene document JSON", () => { ); }); + it("migrates pre-presence NPC entities to always-authored presence", () => { + const migratedDocument = migrateSceneDocument({ + version: PATH_FOUNDATION_SCENE_DOCUMENT_VERSION, + name: "NPC Presence Migration", + time: createDefaultProjectTimeSettings(), + world: createEmptySceneDocument().world, + materials: createEmptySceneDocument().materials, + textures: {}, + assets: {}, + brushes: {}, + paths: {}, + 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, + collider: createNpcEntity().collider + } + }, + interactionLinks: {} + }); + + expect(migratedDocument.version).toBe(SCENE_DOCUMENT_VERSION); + expect(migratedDocument.entities["entity-npc-guide"]).toEqual( + createNpcEntity({ + id: "entity-npc-guide", + actorId: "actor-town-guide", + presence: createNpcAlwaysPresence(), + 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,