返回 DeepSeek-Reasonix
chat_tui_goal_test.go
根目录 / internal / cli / chat_tui_goal_test.go
1 package cli
2
3 import (
4 "strings"
5 "testing"
6
7 "github.com/charmbracelet/x/ansi"
8
9 "reasonix/internal/control"
10 )
11
12 func TestGoalLegacyBudgetFlagNoticesExactlyOnce(t *testing.T) {
13 m := newTestChatTUI()
14 m.ctrl = newOwnedTestController(t, control.Options{})
15 t.Cleanup(m.ctrl.Close)
16
17 m.runGoalSubcommand("/goal --research investigate the failure")
18
19 joined := ansi.Strip(strings.Join(*m.pendingCommit, "\n"))
20 if got := strings.Count(joined, control.GoalBudgetFlagDeprecatedNotice); got != 1 {
21 t.Fatalf("deprecated budget notices = %d, want 1:\n%s", got, joined)
22 }
23 }
24
25 func TestMissingLegacyGoalCommandDoesNotStartTUITurn(t *testing.T) {
26 m := newTestChatTUI()
27 m.ctrl = newOwnedTestController(t, control.Options{WorkspaceRoot: t.TempDir()})
28 t.Cleanup(m.ctrl.Close)
29
30 if cmd := m.runGoalSubcommand("/goal resume .reasonix/autoresearch/missing-task/"); cmd != nil {
31 t.Fatal("missing legacy archive returned a provider turn command")
32 }
33 if got := m.ctrl.GoalStatus(); got != control.GoalStatusBlocked {
34 t.Fatalf("GoalStatus() = %q, want blocked", got)
35 }
36 }
37
37 lines GO