diff options
Diffstat (limited to 'internal/hexaiaction/tui_custom_test.go')
| -rw-r--r-- | internal/hexaiaction/tui_custom_test.go | 9 |
1 files changed, 3 insertions, 6 deletions
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) } |
