From f7a04061a131c05ed33917c5587417ddc6ff6e60 Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Wed, 13 May 2026 03:49:47 +0200 Subject: [PATCH] Add serialization tests for legacy paths and box brushes --- .../serialization/scene-document-json.test.ts | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/tests/serialization/scene-document-json.test.ts b/tests/serialization/scene-document-json.test.ts index 8c531233..2072bfc1 100644 --- a/tests/serialization/scene-document-json.test.ts +++ b/tests/serialization/scene-document-json.test.ts @@ -912,6 +912,41 @@ describe("scene document JSON", () => { }); }); + it("migrates pre-repeater paths to empty repeaters", () => { + const path = createScenePath({ + id: "path-legacy-repeaters", + repeaters: [ + { + id: "repeater-legacy", + assetId: "fence_segment_wood_2m" + } + ] + }); + const document = { + ...createEmptySceneDocument({ name: "Legacy Repeater Scene" }), + paths: { + [path.id]: path + } + }; + const legacyDocument = JSON.parse(serializeSceneDocument(document)) as { + version: number; + paths: Record< + string, + { + repeaters?: unknown; + } + >; + }; + + legacyDocument.version = SPLINE_ROAD_EDGES_SCENE_DOCUMENT_VERSION; + delete legacyDocument.paths[path.id]!.repeaters; + + const migratedDocument = migrateSceneDocument(legacyDocument); + + expect(migratedDocument.version).toBe(SCENE_DOCUMENT_VERSION); + expect(migratedDocument.paths[path.id]?.repeaters).toEqual([]); + }); + it("round-trips a document containing a canonical box brush", () => { const brush = createBoxBrush({ id: "brush-box-room",