From 920b9555a11031e6772224842c86d42337c1dc2b Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Sat, 11 Apr 2026 12:38:47 +0200 Subject: [PATCH] Refactor scene document JSON tests and update player start entity handling --- .../serialization/scene-document-json.test.ts | 58 +++++-------------- 1 file changed, 16 insertions(+), 42 deletions(-) diff --git a/tests/serialization/scene-document-json.test.ts b/tests/serialization/scene-document-json.test.ts index 5b655262..28db2b59 100644 --- a/tests/serialization/scene-document-json.test.ts +++ b/tests/serialization/scene-document-json.test.ts @@ -55,47 +55,25 @@ describe("scene document JSON", () => { const brush = createBoxBrush({ id: "brush-box-room", name: "Entry Room", - center: { - x: 0, - y: 1, - z: 0 - }, - size: { - x: 4, - y: 2, - z: 6 - } - }); - const document = { - ...createEmptySceneDocument({ name: "Brush Scene" }), - brushes: { - [brush.id]: brush - } - }; - - expect(parseSceneDocumentJson(serializeSceneDocument(document))).toEqual(document); - }); - - it("round-trips floating-point whitebox box transforms without accidental snapping", () => { - const brush = createBoxBrush({ - id: "brush-float-transform", - center: { - x: 1.25, - y: 1.5, - z: -0.875 - }, - rotationDegrees: { - x: 12.5, - y: 37.5, - z: -8.25 - }, - size: { - x: 2.5, + const playerStart = createPlayerStartEntity({ + id: "entity-player-start-legacy-look" + }); y: 3.25, z: 4.75 } }); - const document = { + [playerStart.id]: { + ...playerStart, + inputBindings: { + ...playerStart.inputBindings, + gamepad: { + moveForward: playerStart.inputBindings.gamepad.moveForward, + moveBackward: playerStart.inputBindings.gamepad.moveBackward, + moveLeft: playerStart.inputBindings.gamepad.moveLeft, + moveRight: playerStart.inputBindings.gamepad.moveRight + } + } + } ...createEmptySceneDocument({ name: "Float Transform Scene" }), brushes: { [brush.id]: brush @@ -621,11 +599,7 @@ describe("scene document JSON", () => { const migratedDocument = migrateSceneDocument(legacyDocument); expect(migratedDocument.version).toBe(SCENE_DOCUMENT_VERSION); - expect(migratedDocument.entities[playerStart.id]).toEqual( - createPlayerStartEntity({ - ...playerStart - }) - ); + expect(migratedDocument.entities[playerStart.id]).toEqual(playerStart); }); it("migrates version 24 Player Start entities to default to first-person navigation", () => {