summaryrefslogtreecommitdiff
path: root/internal/tmuxedit/run_test.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-02-08 16:31:40 +0200
committerPaul Buetow <paul@buetow.org>2026-02-08 16:31:40 +0200
commitc802ba5803de1a53749bb5c4ecbc0159fceb385f (patch)
tree02e612286f36bc6c65563bc33cf53639817d2db1 /internal/tmuxedit/run_test.go
parent887d7bc186db90c3903851b0f1db2d24df5d7a7b (diff)
refactor tmuxedit to Agent interface with cursor/claude/config implementations
Replace monolithic AgentConfig struct with an Agent interface backed by baseAgent defaults and separate implementations for cursor (box-drawing extraction, bulk backspace clearing) and claude (section-scoped extraction with continuation lines, vim clearing). Simple agents (amp, aider) and user-defined agents use configAgent with baseAgent defaults. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat (limited to 'internal/tmuxedit/run_test.go')
-rw-r--r--internal/tmuxedit/run_test.go15
1 files changed, 8 insertions, 7 deletions
diff --git a/internal/tmuxedit/run_test.go b/internal/tmuxedit/run_test.go
index 2766f6b..1b603e4 100644
--- a/internal/tmuxedit/run_test.go
+++ b/internal/tmuxedit/run_test.go
@@ -9,6 +9,7 @@ import (
)
func TestRunWithConfig_HappyPath(t *testing.T) {
+ noSleep(t)
// Save and restore all seams
oldCapture := capturePane
oldSendKeys := sendKeys
@@ -31,7 +32,7 @@ func TestRunWithConfig_HappyPath(t *testing.T) {
// Mock: capture pane content with Claude Code agent detected
capturePane = func(paneID string) (string, error) {
- return "claude code v1.0\n────\n❯ fix the bug\n────", nil
+ return "claude code v1.0\n──────\n❯ fix the bug\n──────", nil
}
// Mock: editor popup returns modified text
@@ -58,8 +59,7 @@ func TestRunWithConfig_HappyPath(t *testing.T) {
t.Fatalf("unexpected error: %v", err)
}
- // Should have sent: clear (C-u), then the full edited text (both lines)
- // since deduplicateText returns the complete text whenever anything changed.
+ // Should have sent: clear keys, then the full edited text (both lines)
if len(sent) < 2 {
t.Fatalf("expected at least 2 send calls (clear + text), got %d: %v", len(sent), sent)
}
@@ -74,6 +74,7 @@ func TestRunWithConfig_HappyPath(t *testing.T) {
}
func TestRunWithConfig_ExplicitAgent(t *testing.T) {
+ noSleep(t)
oldCapture := capturePane
oldSendKeys := sendKeys
oldEditorPopup := openEditorPopup
@@ -177,16 +178,16 @@ func TestRunWithConfig_CustomDimensions(t *testing.T) {
func TestPickAgent_ExplicitName(t *testing.T) {
agents := builtinAgents()
got := pickAgent("cursor", "Claude Code detected", agents)
- if got.Name != "cursor" {
- t.Errorf("pickAgent(cursor) = %q, want cursor (explicit name should win)", got.Name)
+ if got.Name() != "cursor" {
+ t.Errorf("pickAgent(cursor) = %q, want cursor (explicit name should win)", got.Name())
}
}
func TestPickAgent_AutoDetect(t *testing.T) {
agents := builtinAgents()
got := pickAgent("", "Amp by Sourcegraph", agents)
- if got.Name != "amp" {
- t.Errorf("pickAgent('', amp content) = %q, want amp", got.Name)
+ if got.Name() != "amp" {
+ t.Errorf("pickAgent('', amp content) = %q, want amp", got.Name())
}
}