fix(coding-agent): make tests keybinding-agnostic

Reset global editor keybindings to defaults in beforeEach for
session-selector-rename and tree-selector tests. Pass
KeybindingsManager.inMemory() to SessionSelectorComponent in tests
to avoid reading user keybindings.json.

Closes #2360
This commit is contained in:
Mario Zechner
2026-03-18 16:48:03 +01:00
parent d7befef90e
commit ce095e2846
3 changed files with 25 additions and 5 deletions

View File

@@ -1,4 +1,5 @@
import { beforeAll, describe, expect, test } from "vitest";
import { DEFAULT_EDITOR_KEYBINDINGS, EditorKeybindingsManager, setEditorKeybindings } from "@mariozechner/pi-tui";
import { beforeAll, beforeEach, describe, expect, test } from "vitest";
import type {
ModelChangeEntry,
SessionEntry,
@@ -12,6 +13,11 @@ beforeAll(() => {
initTheme("dark");
});
beforeEach(() => {
// Ensure test isolation: editor keybindings are a global singleton
setEditorKeybindings(new EditorKeybindingsManager(DEFAULT_EDITOR_KEYBINDINGS));
});
// Helper to create a user message entry
function userMessage(id: string, parentId: string | null, content: string): SessionMessageEntry {
return {