From 4c080b5eed8a6ee89f12c6fb68ab2fa15ab1d3fe Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Thu, 30 Apr 2026 00:24:01 +0200 Subject: [PATCH] Add unit tests for player climb input bindings --- tests/unit/player-input-bindings.test.ts | 28 ++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/tests/unit/player-input-bindings.test.ts b/tests/unit/player-input-bindings.test.ts index cd058afc..05cd0c13 100644 --- a/tests/unit/player-input-bindings.test.ts +++ b/tests/unit/player-input-bindings.test.ts @@ -3,6 +3,7 @@ import { describe, expect, it } from "vitest"; import { createPlayerStartInputBindings } from "../../src/entities/entity-instances"; import { resolvePlayerStartClearTargetInput, + resolvePlayerStartClimbInput, resolvePlayerStartInteractInput, resolvePlayerStartPauseInput } from "../../src/runtime-three/player-input-bindings"; @@ -117,3 +118,30 @@ describe("player-input-bindings clear-target input", () => { ).toBe(1); }); }); + +describe("player-input-bindings climb input", () => { + it("resolves authored keyboard climb bindings", () => { + const bindings = createPlayerStartInputBindings({ + keyboard: { + climb: "KeyR" + } + }); + + expect(resolvePlayerStartClimbInput(new Set(["KeyE"]), bindings, [])).toBe( + 0 + ); + expect(resolvePlayerStartClimbInput(new Set(["KeyR"]), bindings, [])).toBe( + 1 + ); + }); + + it("resolves the default gamepad climb binding from the standard right shoulder button", () => { + const bindings = createPlayerStartInputBindings(); + + expect( + resolvePlayerStartClimbInput(new Set(), bindings, [ + createMockGamepad([5]) + ]) + ).toBe(1); + }); +});