import test from "node:test"; import assert from "node:assert/strict"; import { createActionMapper } from "../src/index.js"; test("createActionMapper maps events to actions", () => { const mapper = createActionMapper({ bindings: { confirm: [{ source: "gamepad", control: "a" }], back: [{ source: "keyboard", control: "Escape" }] } }); const updates = mapper.mapEvent({ source: "gamepad", control: "a", type: "pressed", value: 1 }); assert.equal(updates.length, 1); assert.equal(updates[0].action, "confirm"); assert.equal(mapper.getActionState("confirm").active, true); });