From 98a6d6d0308eb3e7b1a2e72e3c574a8500e63509 Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Wed, 13 May 2026 00:07:51 +0200 Subject: [PATCH] Add serialization tests for path migration and box brush round-tripping --- .../serialization/scene-document-json.test.ts | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/tests/serialization/scene-document-json.test.ts b/tests/serialization/scene-document-json.test.ts index a62ebabf..be2ae0b3 100644 --- a/tests/serialization/scene-document-json.test.ts +++ b/tests/serialization/scene-document-json.test.ts @@ -751,6 +751,43 @@ describe("scene document JSON", () => { }); }); + it("migrates pre-road-preview paths to disabled road defaults", () => { + const path = createScenePath({ + id: "path-legacy-road-defaults" + }); + const document = { + ...createEmptySceneDocument({ name: "Legacy Road Preview Scene" }), + paths: { + [path.id]: path + } + }; + const legacyDocument = JSON.parse(serializeSceneDocument(document)) as { + version: number; + paths: Record< + string, + { + road?: unknown; + } + >; + }; + + legacyDocument.version = PATH_TERRAIN_GLUE_SCENE_DOCUMENT_VERSION; + delete legacyDocument.paths[path.id]!.road; + + const migratedDocument = migrateSceneDocument(legacyDocument); + + expect(migratedDocument.version).toBe(SCENE_DOCUMENT_VERSION); + expect(migratedDocument.paths[path.id]?.road).toEqual({ + enabled: false, + width: 2, + shoulderWidth: 1, + falloff: 0.5, + heightOffset: 0.03, + terrainConform: true, + materialId: null + }); + }); + it("round-trips a document containing a canonical box brush", () => { const brush = createBoxBrush({ id: "brush-box-room",