From 872630b71e27078af0ecaec78f456b58490a974f Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Sat, 11 Apr 2026 19:20:32 +0200 Subject: [PATCH] Refactor ground probing logic in first-person navigation controller tests --- ...first-person-navigation-controller.test.ts | 33 ++++++------------- 1 file changed, 10 insertions(+), 23 deletions(-) diff --git a/tests/unit/first-person-navigation-controller.test.ts b/tests/unit/first-person-navigation-controller.test.ts index 57001115..622ab525 100644 --- a/tests/unit/first-person-navigation-controller.test.ts +++ b/tests/unit/first-person-navigation-controller.test.ts @@ -51,13 +51,12 @@ function createRuntimeControllerContext( feetPosition: Vec3, shape: FirstPersonPlayerShape ) => boolean; - options.probePlayerGround?.(feetPosition, shape, maxDistance) ?? - { - grounded: true, - distance: 0, - normal: { x: 0, y: 1, z: 0 }, - slopeDegrees: 0 - }, + } = {} +) { + const runtimeScene = buildRuntimeSceneFromDocument( + { + ...createEmptySceneDocument({ name: "Pointer Lock Scene" }), + entities: { [playerStart.id]: playerStart } }, @@ -327,23 +326,11 @@ describe("FirstPersonNavigationController", () => { maxDistance: number ) => PlayerGroundProbeResult >() - .mockReturnValueOnce({ - grounded: true, - distance: 0, - normal: { x: 0, y: 1, z: 0 }, - slopeDegrees: 0 - }) - .mockReturnValueOnce({ - grounded: true, - distance: 0, - normal: { x: 0, y: 1, z: 0 }, - slopeDegrees: 0 - }) .mockReturnValue({ - grounded: false, - distance: null, - normal: null, - slopeDegrees: null + grounded: true, + distance: 0, + normal: { x: 0, y: 1, z: 0 }, + slopeDegrees: 0 }) } );