MCPcopy Create free account
hub / github.com/MiniCodeMonkey/chief / TestBranchWarningNoConflicts

Function TestBranchWarningNoConflicts

internal/tui/branch_warning_test.go:76–105  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

74}
75
76func TestBranchWarningNoConflicts(t *testing.T) {
77 bw := NewBranchWarning()
78 bw.SetSize(80, 24)
79 bw.SetContext("feature/x", "auth", ".chief/worktrees/auth/")
80 bw.SetDialogContext(DialogNoConflicts)
81 bw.Reset()
82
83 // Should have 3 options: run in current dir, create worktree+branch, cancel
84 if len(bw.options) != 3 {
85 t.Fatalf("expected 3 options for no conflicts, got %d", len(bw.options))
86 }
87
88 // First option should be "Run in current directory" (recommended)
89 if bw.options[0].option != BranchOptionContinue {
90 t.Errorf("expected first option to be Continue (current dir), got %v", bw.options[0].option)
91 }
92 if !bw.options[0].recommended {
93 t.Error("expected first option to be recommended")
94 }
95
96 // Second option should be "Create worktree + branch"
97 if bw.options[1].option != BranchOptionCreateWorktree {
98 t.Errorf("expected second option to be CreateWorktree, got %v", bw.options[1].option)
99 }
100
101 // Third option should be Cancel
102 if bw.options[2].option != BranchOptionCancel {
103 t.Errorf("expected third option to be Cancel, got %v", bw.options[2].option)
104 }
105}
106
107func TestBranchWarningNavigation(t *testing.T) {
108 bw := NewBranchWarning()

Callers

nothing calls this directly

Calls 5

SetSizeMethod · 0.95
SetContextMethod · 0.95
SetDialogContextMethod · 0.95
ResetMethod · 0.95
NewBranchWarningFunction · 0.85

Tested by

no test coverage detected