@@ -13,6 +13,7 @@ import (
1313
1414 "errors"
1515
16+ "github.com/slackhq/gh-stacked-diff/v2/gitutil"
1617 "github.com/slackhq/gh-stacked-diff/v2/interactive"
1718 "github.com/slackhq/gh-stacked-diff/v2/templates"
1819 "github.com/slackhq/gh-stacked-diff/v2/testutil"
@@ -31,10 +32,10 @@ func TestSdAddReviewers_AddReviewers(t *testing.T) {
3132 allCommits := templates .GetAllCommits ()
3233 testExecutor .SetResponse (
3334 // Each check has 3 values: status, conclusion, and state. Copied DefaultMinChecks times.
34- strings .Repeat ("SUCCESS\n SUCCESS\n SUCCESS\n " , util .DefaultMinChecks ),
35+ strings .Repeat ("SUCCESS\n SUCCESS\n SUCCESS\n " , gitutil .DefaultMinChecks ),
3536 nil , "gh" , "pr" , "view" , util .MatchAnyRemainingArgs )
3637
37- testParseArguments ("add-reviewers" , "--min-checks" , fmt .Sprint (util .DefaultMinChecks ), "--reviewers=mybestie" , allCommits [0 ].Commit )
38+ testParseArguments ("add-reviewers" , "--min-checks" , fmt .Sprint (gitutil .DefaultMinChecks ), "--reviewers=mybestie" , allCommits [0 ].Commit )
3839
3940 contains := slices .ContainsFunc (testExecutor .Responses , func (next util.ExecutedResponse ) bool {
4041 ghExpectedArgs := []string {"pr" , "edit" , allCommits [0 ].Branch , "--add-reviewer" , "mybestie" }
@@ -57,10 +58,10 @@ func TestSdAddReviewers_WhenUsingListIndicator_AddReviewers(t *testing.T) {
5758 allCommits := templates .GetAllCommits ()
5859 testExecutor .SetResponse (
5960 // Each check has 3 values: status, conclusion, and state. Copied DefaultMinChecks times.
60- strings .Repeat ("SUCCESS\n SUCCESS\n SUCCESS\n " , util .DefaultMinChecks ),
61+ strings .Repeat ("SUCCESS\n SUCCESS\n SUCCESS\n " , gitutil .DefaultMinChecks ),
6162 nil , "gh" , "pr" , "view" , util .MatchAnyRemainingArgs )
6263
63- testParseArguments ("add-reviewers" , "--min-checks" , fmt .Sprint (util .DefaultMinChecks ), "--indicator=list" , "--reviewers=mybestie" , "1" )
64+ testParseArguments ("add-reviewers" , "--min-checks" , fmt .Sprint (gitutil .DefaultMinChecks ), "--indicator=list" , "--reviewers=mybestie" , "1" )
6465
6566 contains := slices .ContainsFunc (testExecutor .Responses , func (next util.ExecutedResponse ) bool {
6667 ghExpectedArgs := []string {"pr" , "edit" , allCommits [0 ].Branch , "--add-reviewer" , "mybestie" }
@@ -83,11 +84,11 @@ func TestSdAddReviewers_WhenOmittingCommitIndicator_AsksForSelection(t *testing.
8384 allCommits := templates .GetAllCommits ()
8485 testExecutor .SetResponse (
8586 // Each check has 3 values: status, conclusion, and state. Copied DefaultMinChecks times.
86- strings .Repeat ("SUCCESS\n SUCCESS\n SUCCESS\n " , util .DefaultMinChecks ),
87+ strings .Repeat ("SUCCESS\n SUCCESS\n SUCCESS\n " , gitutil .DefaultMinChecks ),
8788 nil , "gh" , "pr" , "view" , util .MatchAnyRemainingArgs )
8889
8990 interactive .SendToProgram (0 , interactive .NewMessageKey (tea .KeyEnter ))
90- testParseArguments ("add-reviewers" , "--min-checks" , fmt .Sprint (util .DefaultMinChecks ), "--indicator=list" , "--reviewers=mybestie" )
91+ testParseArguments ("add-reviewers" , "--min-checks" , fmt .Sprint (gitutil .DefaultMinChecks ), "--indicator=list" , "--reviewers=mybestie" )
9192
9293 contains := slices .ContainsFunc (testExecutor .Responses , func (next util.ExecutedResponse ) bool {
9394 ghExpectedArgs := []string {"pr" , "edit" , allCommits [0 ].Branch , "--add-reviewer" , "mybestie" }
@@ -109,7 +110,7 @@ func TestSdAddReviewers_WhenUserAlreadyApproved_DoesNotRequestReview(t *testing.
109110
110111 allCommits := templates .GetAllCommits ()
111112 // Each check has 3 values: status, conclusion, and state. Copied DefaultMinChecks times.
112- checksSuccess := strings .Repeat ("SUCCESS\n SUCCESS\n SUCCESS\n " , util .DefaultMinChecks )
113+ checksSuccess := strings .Repeat ("SUCCESS\n SUCCESS\n SUCCESS\n " , gitutil .DefaultMinChecks )
113114 testExecutor .SetResponseFunc (checksSuccess , nil , func (programName string , args ... string ) bool {
114115 return programName == "gh" &&
115116 args [0 ] == "pr" &&
@@ -125,7 +126,7 @@ func TestSdAddReviewers_WhenUserAlreadyApproved_DoesNotRequestReview(t *testing.
125126 slices .Contains (args , "reviews" )
126127 })
127128
128- out := testParseArguments ("--log-level=info" , "add-reviewers" , "--min-checks" , fmt .Sprint (util .DefaultMinChecks ), "--reviewers=alreadyapproved2,mybestie,alreadyapproved1" , "1" )
129+ out := testParseArguments ("--log-level=info" , "add-reviewers" , "--min-checks" , fmt .Sprint (gitutil .DefaultMinChecks ), "--reviewers=alreadyapproved2,mybestie,alreadyapproved1" , "1" )
129130
130131 contains := slices .ContainsFunc (testExecutor .Responses , func (next util.ExecutedResponse ) bool {
131132 ghExpectedArgs := []string {"pr" , "edit" , allCommits [0 ].Branch , "--add-reviewer" , "mybestie" }
@@ -149,15 +150,15 @@ func TestSdAddReviewers_UserChoosesHistory_ChoosesSameReviewers(t *testing.T) {
149150
150151 allCommits := templates .GetAllCommits ()
151152 // Each check has 3 values: status, conclusion, and state. Copied DefaultMinChecks times.
152- checksSuccess := strings .Repeat ("SUCCESS\n SUCCESS\n SUCCESS\n " , util .DefaultMinChecks )
153+ checksSuccess := strings .Repeat ("SUCCESS\n SUCCESS\n SUCCESS\n " , gitutil .DefaultMinChecks )
153154 testExecutor .SetResponseFunc (checksSuccess , nil , func (programName string , args ... string ) bool {
154155 return programName == "gh" &&
155156 args [0 ] == "pr" &&
156157 args [1 ] == "view" &&
157158 slices .Contains (args , "statusCheckRollup" )
158159 })
159160
160- testParseArguments ("add-reviewers" , "--min-checks" , fmt .Sprint (util .DefaultMinChecks ), "--reviewers=mybestie" , "1" )
161+ testParseArguments ("add-reviewers" , "--min-checks" , fmt .Sprint (gitutil .DefaultMinChecks ), "--reviewers=mybestie" , "1" )
161162
162163 // Clear responses.
163164 testExecutor .Responses = []util.ExecutedResponse {}
@@ -167,7 +168,7 @@ func TestSdAddReviewers_UserChoosesHistory_ChoosesSameReviewers(t *testing.T) {
167168 interactive .NewMessageKey (tea .KeyUp ),
168169 interactive .NewMessageKey (tea .KeyEnter ),
169170 )
170- testParseArguments ("add-reviewers" , "--min-checks" , fmt .Sprint (util .DefaultMinChecks ), "1" )
171+ testParseArguments ("add-reviewers" , "--min-checks" , fmt .Sprint (gitutil .DefaultMinChecks ), "1" )
171172
172173 contains := slices .ContainsFunc (testExecutor .Responses , func (next util.ExecutedResponse ) bool {
173174 ghExpectedArgs := []string {"pr" , "edit" , allCommits [0 ].Branch , "--add-reviewer" , "mybestie" }
@@ -189,7 +190,7 @@ func TestSdAddReviewers_UserChoosesHistoryFromTyped_ChoosesSameReviewers(t *test
189190
190191 allCommits := templates .GetAllCommits ()
191192 // Each check has 3 values: status, conclusion, and state. Copied DefaultMinChecks times.
192- checksSuccess := strings .Repeat ("SUCCESS\n SUCCESS\n SUCCESS\n " , util .DefaultMinChecks )
193+ checksSuccess := strings .Repeat ("SUCCESS\n SUCCESS\n SUCCESS\n " , gitutil .DefaultMinChecks )
193194 testExecutor .SetResponseFunc (checksSuccess , nil , func (programName string , args ... string ) bool {
194195 return programName == "gh" &&
195196 args [0 ] == "pr" &&
@@ -203,7 +204,7 @@ func TestSdAddReviewers_UserChoosesHistoryFromTyped_ChoosesSameReviewers(t *test
203204 interactive .NewMessageRune ('y' ),
204205 interactive .NewMessageKey (tea .KeyEnter ),
205206 )
206- testParseArguments ("add-reviewers" , "--min-checks" , fmt .Sprint (util .DefaultMinChecks ), "1" )
207+ testParseArguments ("add-reviewers" , "--min-checks" , fmt .Sprint (gitutil .DefaultMinChecks ), "1" )
207208
208209 // Clear responses.
209210 testExecutor .Responses = []util.ExecutedResponse {}
@@ -213,7 +214,7 @@ func TestSdAddReviewers_UserChoosesHistoryFromTyped_ChoosesSameReviewers(t *test
213214 interactive .NewMessageKey (tea .KeyUp ),
214215 interactive .NewMessageKey (tea .KeyEnter ),
215216 )
216- testParseArguments ("add-reviewers" , "--min-checks" , fmt .Sprint (util .DefaultMinChecks ), "1" )
217+ testParseArguments ("add-reviewers" , "--min-checks" , fmt .Sprint (gitutil .DefaultMinChecks ), "1" )
217218
218219 contains := slices .ContainsFunc (testExecutor .Responses , func (next util.ExecutedResponse ) bool {
219220 ghExpectedArgs := []string {"pr" , "edit" , allCommits [0 ].Branch , "--add-reviewer" , "my" }
@@ -232,12 +233,12 @@ func TestSdAddReviewers_WhenNoReviewersSelected_DoesNotAddReviewers(t *testing.T
232233 testParseArguments ("new" , "1" )
233234
234235 testExecutor .SetResponse (
235- strings .Repeat ("SUCCESS\n SUCCESS\n SUCCESS\n " , util .DefaultMinChecks ),
236+ strings .Repeat ("SUCCESS\n SUCCESS\n SUCCESS\n " , gitutil .DefaultMinChecks ),
236237 nil , "gh" , "pr" , "view" , util .MatchAnyRemainingArgs )
237238
238239 // Select PR, then enter empty reviewers.
239240 interactive .SendToProgram (0 , interactive .NewMessageKey (tea .KeyEnter ))
240- testParseArguments ("add-reviewers" , "--min-checks" , fmt .Sprint (util .DefaultMinChecks ), "1" )
241+ testParseArguments ("add-reviewers" , "--min-checks" , fmt .Sprint (gitutil .DefaultMinChecks ), "1" )
241242
242243 assertGhSubcommandCalled (t , testExecutor .Responses , false , "pr" , "edit" )
243244 assertGhSubcommandCalled (t , testExecutor .Responses , true , "pr" , "ready" )
@@ -255,10 +256,10 @@ func TestSdAddReviewers_WhenMergeFlag_EnablesAutoMerge(t *testing.T) {
255256 allCommits := templates .GetAllCommits ()
256257 testExecutor .SetResponse (
257258 // Each check has 3 values: status, conclusion, and state. Copied DefaultMinChecks times.
258- strings .Repeat ("SUCCESS\n SUCCESS\n SUCCESS\n " , util .DefaultMinChecks ),
259+ strings .Repeat ("SUCCESS\n SUCCESS\n SUCCESS\n " , gitutil .DefaultMinChecks ),
259260 nil , "gh" , "pr" , "view" , util .MatchAnyRemainingArgs )
260261
261- testParseArguments ("add-reviewers" , "--min-checks" , fmt .Sprint (util .DefaultMinChecks ), "--merge" , "--reviewers=mybestie" , allCommits [0 ].Commit )
262+ testParseArguments ("add-reviewers" , "--min-checks" , fmt .Sprint (gitutil .DefaultMinChecks ), "--merge" , "--reviewers=mybestie" , allCommits [0 ].Commit )
262263
263264 contains := slices .ContainsFunc (testExecutor .Responses , func (next util.ExecutedResponse ) bool {
264265 ghExpectedArgs := []string {"pr" , "merge" , allCommits [0 ].Branch , "--auto" , "--squash" }
@@ -280,7 +281,7 @@ func TestSdAddReviewers_WhenMinChecksFails_UsesDefault(t *testing.T) {
280281
281282 allCommits := templates .GetAllCommits ()
282283 // Each check has 3 values: status, conclusion, and state. Copied DefaultMinChecks times.
283- checksSuccess := strings .Repeat ("SUCCESS\n SUCCESS\n SUCCESS\n " , util .DefaultMinChecks )
284+ checksSuccess := strings .Repeat ("SUCCESS\n SUCCESS\n SUCCESS\n " , gitutil .DefaultMinChecks )
284285 testExecutor .SetResponseFunc (checksSuccess , nil , func (programName string , args ... string ) bool {
285286 return programName == "gh" &&
286287 args [0 ] == "pr" &&
0 commit comments