Add unit tests for player climb input bindings
This commit is contained in:
@@ -3,6 +3,7 @@ import { describe, expect, it } from "vitest";
|
|||||||
import { createPlayerStartInputBindings } from "../../src/entities/entity-instances";
|
import { createPlayerStartInputBindings } from "../../src/entities/entity-instances";
|
||||||
import {
|
import {
|
||||||
resolvePlayerStartClearTargetInput,
|
resolvePlayerStartClearTargetInput,
|
||||||
|
resolvePlayerStartClimbInput,
|
||||||
resolvePlayerStartInteractInput,
|
resolvePlayerStartInteractInput,
|
||||||
resolvePlayerStartPauseInput
|
resolvePlayerStartPauseInput
|
||||||
} from "../../src/runtime-three/player-input-bindings";
|
} from "../../src/runtime-three/player-input-bindings";
|
||||||
@@ -117,3 +118,30 @@ describe("player-input-bindings clear-target input", () => {
|
|||||||
).toBe(1);
|
).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);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user