Feat: Add player start settings and clear target input binding tests

This commit is contained in:
2026-04-27 16:00:56 +02:00
parent 7b56e540bf
commit d5ba85b55f
3 changed files with 40 additions and 31 deletions

View File

@@ -2,6 +2,7 @@ import { describe, expect, it } from "vitest";
import { createPlayerStartInputBindings } from "../../src/entities/entity-instances";
import {
resolvePlayerStartClearTargetInput,
resolvePlayerStartInteractInput,
resolvePlayerStartPauseInput
} from "../../src/runtime-three/player-input-bindings";
@@ -85,3 +86,34 @@ describe("player-input-bindings interact input", () => {
).toBe(1);
});
});
describe("player-input-bindings clear-target input", () => {
it("resolves authored keyboard clear-target bindings", () => {
const bindings = createPlayerStartInputBindings({
keyboard: {
clearTarget: "KeyQ"
}
});
expect(
resolvePlayerStartClearTargetInput(new Set(["Escape"]), bindings, [])
).toBe(0);
expect(
resolvePlayerStartClearTargetInput(new Set(["KeyQ"]), bindings, [])
).toBe(1);
});
it("resolves the authored gamepad clear-target binding from the standard north button", () => {
const bindings = createPlayerStartInputBindings({
gamepad: {
clearTarget: "buttonNorth"
}
});
expect(
resolvePlayerStartClearTargetInput(new Set<string>(), bindings, [
createMockGamepad([3])
])
).toBe(1);
});
});