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

Function TestBranchWarningNavigation

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

Source from the content-addressed store, hash-verified

105}
106
107func TestBranchWarningNavigation(t *testing.T) {
108 bw := NewBranchWarning()
109 bw.SetSize(80, 24)
110 bw.SetContext("main", "auth", ".chief/worktrees/auth/")
111 bw.SetDialogContext(DialogProtectedBranch)
112 bw.Reset()
113
114 // Start at index 0
115 if bw.selectedIndex != 0 {
116 t.Fatalf("expected initial index 0, got %d", bw.selectedIndex)
117 }
118
119 // Move down
120 bw.MoveDown()
121 if bw.selectedIndex != 1 {
122 t.Errorf("expected index 1 after MoveDown, got %d", bw.selectedIndex)
123 }
124
125 // Move down to the end
126 bw.MoveDown()
127 bw.MoveDown()
128 if bw.selectedIndex != 3 {
129 t.Errorf("expected index 3, got %d", bw.selectedIndex)
130 }
131
132 // Can't go past the end
133 bw.MoveDown()
134 if bw.selectedIndex != 3 {
135 t.Errorf("expected index to stay at 3, got %d", bw.selectedIndex)
136 }
137
138 // Move up
139 bw.MoveUp()
140 if bw.selectedIndex != 2 {
141 t.Errorf("expected index 2 after MoveUp, got %d", bw.selectedIndex)
142 }
143
144 // Move up to the start
145 bw.MoveUp()
146 bw.MoveUp()
147 if bw.selectedIndex != 0 {
148 t.Errorf("expected index 0, got %d", bw.selectedIndex)
149 }
150
151 // Can't go past the start
152 bw.MoveUp()
153 if bw.selectedIndex != 0 {
154 t.Errorf("expected index to stay at 0, got %d", bw.selectedIndex)
155 }
156}
157
158func TestBranchWarningBranchEdit(t *testing.T) {
159 bw := NewBranchWarning()

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected