import { describe, expect, it } from "bun:test"; import { getDefaultPasteImageKeys, KeybindingsManager } from "@oh-my-pi/pi-coding-agent/config/keybindings"; describe("KeybindingsManager.getDisplayString", () => { it("formats a single binding as a human-readable key hint", () => { const keybindings = KeybindingsManager.inMemory({ "app.message.dequeue": "alt+up", }); expect(keybindings.getDisplayString("app.message.dequeue")).toBe("Alt+Up"); }); it("defaults retry to Alt+R", () => { const keybindings = KeybindingsManager.inMemory(); expect(keybindings.getDisplayString("app.retry")).toBe("Alt+R"); }); it("formats multiple bindings with the existing separator", () => { const keybindings = KeybindingsManager.inMemory({ "app.clipboard.copyPrompt": ["alt+shift+c", "ctrl+shift+c"], }); expect(keybindings.getDisplayString("app.clipboard.copyPrompt")).toBe("Alt+Shift+C/Ctrl+Shift+C"); }); it("returns an empty string when the action has no binding", () => { const keybindings = KeybindingsManager.inMemory({ "app.clipboard.copyPrompt": [], }); expect(keybindings.getDisplayString("app.clipboard.copyPrompt")).toBe(""); }); }); describe("getDefaultPasteImageKeys", () => { it("keeps Ctrl+V registered for image paste on Windows alongside the terminal-safe fallback", () => { expect(getDefaultPasteImageKeys("win32")).toEqual(["ctrl+v", "alt+v"]); }); it("uses Ctrl+V as the image-paste shortcut on non-Windows platforms", () => { expect(getDefaultPasteImageKeys("linux")).toEqual(["ctrl+v"]); expect(getDefaultPasteImageKeys("darwin")).toEqual(["ctrl+v"]); }); });