summaryrefslogtreecommitdiff
path: root/internal/hexaiaction/run_more_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/hexaiaction/run_more_test.go')
-rw-r--r--internal/hexaiaction/run_more_test.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/internal/hexaiaction/run_more_test.go b/internal/hexaiaction/run_more_test.go
index 6a4959e..67ffa96 100644
--- a/internal/hexaiaction/run_more_test.go
+++ b/internal/hexaiaction/run_more_test.go
@@ -3,6 +3,7 @@ package hexaiaction
import (
"bytes"
"context"
+ "log"
"os"
"strings"
"testing"
@@ -28,6 +29,22 @@ func TestRun_MissingAPIKey(t *testing.T) {
_ = os.Stderr
}
+func TestRun_NoInput_IsActionable(t *testing.T) {
+ runner := NewRunner()
+ runner.loadConfig = func(context.Context, *log.Logger) appconfig.App { return appconfig.Load(nil) }
+ runner.newClient = func(appconfig.App) (actionClient, error) { return llmFake{}, nil }
+ runner.chooseAction = func(appconfig.App) (actionChoice, error) {
+ return actionChoice{kind: ActionSkip}, nil
+ }
+ err := runner.Run(context.Background(), bytes.NewBufferString(""), &bytes.Buffer{}, &bytes.Buffer{})
+ if err == nil {
+ t.Fatal("expected actionable no-input error")
+ }
+ if !strings.Contains(err.Error(), "pipe the selected text or pane contents into hexai-tmux-action") {
+ t.Fatalf("expected actionable guidance, got %q", err.Error())
+ }
+}
+
type stubChatDoer struct {
calls int
msgs [][]llm.Message