Add unit tests for player climb input bindings

This commit is contained in:
2026-04-30 00:24:01 +02:00
parent f04f42ec7c
commit 4c080b5eed

View File

@@ -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<string>(), bindings, [
createMockGamepad([5])
])
).toBe(1);
});
});