diff options
| author | Paul Buetow <paul@buetow.org> | 2026-06-18 08:05:32 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-06-18 08:05:32 +0300 |
| commit | a80ad2b4691d0df63f68c6977ee18444e7bb752f (patch) | |
| tree | 6edc47fcc3c929856826432cf3df3394a14934e8 /internal/hexaiaction | |
| parent | 4ffb22e7f69f1c9c79b095d4e60bad3d97aac55b (diff) | |
ik0 replace remaining test seams with DI
Diffstat (limited to 'internal/hexaiaction')
| -rw-r--r-- | internal/hexaiaction/tui_custom.go | 2 | ||||
| -rw-r--r-- | internal/hexaiaction/tui_custom_test.go | 17 |
2 files changed, 18 insertions, 1 deletions
diff --git a/internal/hexaiaction/tui_custom.go b/internal/hexaiaction/tui_custom.go index 910242f..876f60a 100644 --- a/internal/hexaiaction/tui_custom.go +++ b/internal/hexaiaction/tui_custom.go @@ -29,7 +29,7 @@ func (r tuiRunner) program(m model) teaProgram { func (r tuiRunner) RunTUIWithCustom(customs []appconfig.CustomAction, menuHotkey string) (ActionKind, *appconfig.CustomAction, error) { // When no customs, fall back to default menu if len(customs) == 0 { - kind, err := RunTUI() + kind, err := r.RunTUI() return kind, nil, err } // Build main menu with an extra entry diff --git a/internal/hexaiaction/tui_custom_test.go b/internal/hexaiaction/tui_custom_test.go index 7f7e2d3..62d37cb 100644 --- a/internal/hexaiaction/tui_custom_test.go +++ b/internal/hexaiaction/tui_custom_test.go @@ -71,3 +71,20 @@ func TestRunTUIWithCustom_SubmenuAndHotkeys(t *testing.T) { t.Fatalf("expected selected custom a, got %+v", selected) } } + +func TestRunTUIWithCustom_EmptyCustomsUsesRunner(t *testing.T) { + r := tuiRunner{newProgram: func(m model) teaProgram { + return fakeProg{m: m, onRun: func(mm *model) { mm.chosen = ActionDocument }} + }} + + kind, selected, err := r.RunTUIWithCustom(nil, "") + if err != nil { + t.Fatalf("RunTUIWithCustom error: %v", err) + } + if kind != ActionDocument { + t.Fatalf("kind = %s, want %s", kind, ActionDocument) + } + if selected != nil { + t.Fatalf("selected = %+v, want nil", selected) + } +} |
