From 4ffb22e7f69f1c9c79b095d4e60bad3d97aac55b Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Thu, 18 Jun 2026 07:45:37 +0300 Subject: ik0 replace test seams with dependency injection --- internal/hexaiaction/tui_custom_test.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'internal/hexaiaction/tui_custom_test.go') diff --git a/internal/hexaiaction/tui_custom_test.go b/internal/hexaiaction/tui_custom_test.go index 5ded806..7f7e2d3 100644 --- a/internal/hexaiaction/tui_custom_test.go +++ b/internal/hexaiaction/tui_custom_test.go @@ -21,11 +21,8 @@ func (f fakeProg) Run() (tea.Model, error) { } func TestRunTUIWithCustom_SubmenuAndHotkeys(t *testing.T) { - old := teaNewProgram - t.Cleanup(func() { teaNewProgram = old }) - calls := 0 - teaNewProgram = func(m model) teaProgram { + r := tuiRunner{newProgram: func(m model) teaProgram { calls++ if calls == 1 { // Main menu should have "Custom actions…" with configured hotkey @@ -57,13 +54,13 @@ func TestRunTUIWithCustom_SubmenuAndHotkeys(t *testing.T) { return fakeProg{m: m, onRun: func(mm *model) { mm.list.Select(0) }} } return fakeProg{m: m} - } + }} customs := []appconfig.CustomAction{ {ID: "a", Title: "A", Hotkey: "x", Instruction: "do"}, {ID: "b", Title: "B", Hotkey: "y", Instruction: "do2"}, } - kind, selected, err := RunTUIWithCustom(customs, "z") + kind, selected, err := r.RunTUIWithCustom(customs, "z") if err != nil { t.Fatalf("RunTUIWithCustom error: %v", err) } -- cgit v1.2.3