import { describe, expect, test } from "bun:test"; import { commandIds } from "@commands/ids"; import type { Dispatch } from "@commands/dispatcher"; import { handleToolKey } from "./tool-keybinds"; describe("tool keybinds", () => { test("selects the feather tool with F", () => { const dispatched: unknown[] = []; const consumed = handleToolKey({ event: { key: "f", code: "KeyF", altKey: false, ctrlKey: false, metaKey: false, shiftKey: false }, dispatch: ((commandId: unknown, payload: unknown) => { dispatched.push({ commandId, payload }); return undefined; }) as unknown as Dispatch, }); expect(consumed).toBe(true); expect(dispatched).toEqual([{ commandId: commandIds.toolSetActive, payload: { tool: "feather" } }]); }); });