@@ -11,12 +11,24 @@ import (
1111 "testing"
1212 "time"
1313
14+ "github.com/briandowns/spinner"
15+
1416 "github.com/cli/cli/context"
1517 "github.com/cli/cli/internal/run"
1618 "github.com/cli/cli/test"
19+ "github.com/cli/cli/utils"
1720)
1821
22+ func stubSpinner () {
23+ // not bothering with teardown since we never want spinners when doing tests
24+ utils .StartSpinner = func (_ * spinner.Spinner ) {
25+ }
26+ utils .StopSpinner = func (_ * spinner.Spinner ) {
27+ }
28+ }
29+
1930func TestRepoFork_already_forked (t * testing.T ) {
31+ stubSpinner ()
2032 initContext = func () context.Context {
2133 ctx := context .NewBlank ()
2234 ctx .SetBaseRepo ("OWNER/REPO" )
@@ -42,6 +54,7 @@ func TestRepoFork_already_forked(t *testing.T) {
4254}
4355
4456func TestRepoFork_reuseRemote (t * testing.T ) {
57+ stubSpinner ()
4558 initContext = func () context.Context {
4659 ctx := context .NewBlank ()
4760 ctx .SetBaseRepo ("OWNER/REPO" )
@@ -77,6 +90,7 @@ func stubSince(d time.Duration) func() {
7790}
7891
7992func TestRepoFork_in_parent (t * testing.T ) {
93+ stubSpinner ()
8094 initBlankContext ("" , "OWNER/REPO" , "master" )
8195 defer stubSince (2 * time .Second )()
8296 http := initFakeHTTP ()
@@ -98,6 +112,7 @@ func TestRepoFork_in_parent(t *testing.T) {
98112}
99113
100114func TestRepoFork_outside (t * testing.T ) {
115+ stubSpinner ()
101116 tests := []struct {
102117 name string
103118 args string
@@ -134,6 +149,7 @@ func TestRepoFork_outside(t *testing.T) {
134149}
135150
136151func TestRepoFork_in_parent_yes (t * testing.T ) {
152+ stubSpinner ()
137153 initBlankContext ("" , "OWNER/REPO" , "master" )
138154 defer stubSince (2 * time .Second )()
139155 http := initFakeHTTP ()
@@ -168,6 +184,7 @@ func TestRepoFork_in_parent_yes(t *testing.T) {
168184}
169185
170186func TestRepoFork_outside_yes (t * testing.T ) {
187+ stubSpinner ()
171188 defer stubSince (2 * time .Second )()
172189 http := initFakeHTTP ()
173190 defer http .StubWithFixture (200 , "forkResult.json" )()
@@ -194,6 +211,7 @@ func TestRepoFork_outside_yes(t *testing.T) {
194211}
195212
196213func TestRepoFork_outside_survey_yes (t * testing.T ) {
214+ stubSpinner ()
197215 defer stubSince (2 * time .Second )()
198216 http := initFakeHTTP ()
199217 defer http .StubWithFixture (200 , "forkResult.json" )()
@@ -227,6 +245,7 @@ func TestRepoFork_outside_survey_yes(t *testing.T) {
227245}
228246
229247func TestRepoFork_outside_survey_no (t * testing.T ) {
248+ stubSpinner ()
230249 defer stubSince (2 * time .Second )()
231250 http := initFakeHTTP ()
232251 defer http .StubWithFixture (200 , "forkResult.json" )()
@@ -261,6 +280,7 @@ func TestRepoFork_outside_survey_no(t *testing.T) {
261280}
262281
263282func TestRepoFork_in_parent_survey_yes (t * testing.T ) {
283+ stubSpinner ()
264284 initBlankContext ("" , "OWNER/REPO" , "master" )
265285 defer stubSince (2 * time .Second )()
266286 http := initFakeHTTP ()
@@ -303,6 +323,7 @@ func TestRepoFork_in_parent_survey_yes(t *testing.T) {
303323}
304324
305325func TestRepoFork_in_parent_survey_no (t * testing.T ) {
326+ stubSpinner ()
306327 initBlankContext ("" , "OWNER/REPO" , "master" )
307328 defer stubSince (2 * time .Second )()
308329 http := initFakeHTTP ()
0 commit comments