From 0554e530cbbf8a0143201140dbcd611ae4b76fcc Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Tue, 12 May 2026 22:49:12 +0200 Subject: [PATCH] Add test case for migrating pre-spline paths to linear curve defaults --- .../serialization/scene-document-json.test.ts | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/tests/serialization/scene-document-json.test.ts b/tests/serialization/scene-document-json.test.ts index b9870e58..16d9f1fe 100644 --- a/tests/serialization/scene-document-json.test.ts +++ b/tests/serialization/scene-document-json.test.ts @@ -681,6 +681,40 @@ describe("scene document JSON", () => { ); }); + it("migrates pre-spline paths to linear curve defaults", () => { + const path = createScenePath({ + id: "path-legacy-spline-defaults" + }); + const document = { + ...createEmptySceneDocument({ name: "Legacy Path Scene" }), + paths: { + [path.id]: path + } + }; + const legacyDocument = JSON.parse(serializeSceneDocument(document)) as { + version: number; + paths: Record< + string, + { + curveMode?: string; + sampledResolution?: number; + } + >; + }; + + legacyDocument.version = NPC_TARGET_ANCHOR_SCENE_DOCUMENT_VERSION; + delete legacyDocument.paths[path.id]!.curveMode; + delete legacyDocument.paths[path.id]!.sampledResolution; + + const migratedDocument = migrateSceneDocument(legacyDocument); + + expect(migratedDocument.version).toBe(SCENE_DOCUMENT_VERSION); + expect(migratedDocument.paths[path.id]).toMatchObject({ + curveMode: "linear", + sampledResolution: 12 + }); + }); + it("round-trips a document containing a canonical box brush", () => { const brush = createBoxBrush({ id: "brush-box-room",