Skip to content

Commit a2bee1f

Browse files
committed
🔥 utils.Spinner
1 parent aa0de5f commit a2bee1f

File tree

3 files changed

+0
-32
lines changed

3 files changed

+0
-32
lines changed

pkg/cmd/issue/view/view_test.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,13 @@ import (
88
"os/exec"
99
"testing"
1010

11-
"github.com/briandowns/spinner"
1211
"github.com/cli/cli/internal/config"
1312
"github.com/cli/cli/internal/ghrepo"
1413
"github.com/cli/cli/internal/run"
1514
"github.com/cli/cli/pkg/cmdutil"
1615
"github.com/cli/cli/pkg/httpmock"
1716
"github.com/cli/cli/pkg/iostreams"
1817
"github.com/cli/cli/test"
19-
"github.com/cli/cli/utils"
2018
"github.com/google/shlex"
2119
"github.com/stretchr/testify/assert"
2220
)
@@ -404,7 +402,6 @@ func TestIssueView_tty_Comments(t *testing.T) {
404402
}
405403
for name, tc := range tests {
406404
t.Run(name, func(t *testing.T) {
407-
stubSpinner()
408405
http := &httpmock.Registry{}
409406
defer http.Verify(t)
410407
for name, file := range tc.fixtures {
@@ -496,8 +493,3 @@ func TestIssueView_nontty_Comments(t *testing.T) {
496493
})
497494
}
498495
}
499-
500-
func stubSpinner() {
501-
utils.StartSpinner = func(_ *spinner.Spinner) {}
502-
utils.StopSpinner = func(_ *spinner.Spinner) {}
503-
}

pkg/cmd/pr/view/view_test.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import (
99
"strings"
1010
"testing"
1111

12-
"github.com/briandowns/spinner"
1312
"github.com/cli/cli/context"
1413
"github.com/cli/cli/git"
1514
"github.com/cli/cli/internal/config"
@@ -19,7 +18,6 @@ import (
1918
"github.com/cli/cli/pkg/httpmock"
2019
"github.com/cli/cli/pkg/iostreams"
2120
"github.com/cli/cli/test"
22-
"github.com/cli/cli/utils"
2321
"github.com/google/shlex"
2422
"github.com/stretchr/testify/assert"
2523
"github.com/stretchr/testify/require"
@@ -777,7 +775,6 @@ func TestPRView_tty_Comments(t *testing.T) {
777775
}
778776
for name, tt := range tests {
779777
t.Run(name, func(t *testing.T) {
780-
stubSpinner()
781778
http := &httpmock.Registry{}
782779
defer http.Verify(t)
783780
for name, file := range tt.fixtures {
@@ -873,8 +870,3 @@ func TestPRView_nontty_Comments(t *testing.T) {
873870
})
874871
}
875872
}
876-
877-
func stubSpinner() {
878-
utils.StartSpinner = func(_ *spinner.Spinner) {}
879-
utils.StopSpinner = func(_ *spinner.Spinner) {}
880-
}

utils/utils.go

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,10 @@ package utils
22

33
import (
44
"fmt"
5-
"io"
65
"net/url"
76
"strings"
87
"time"
98

10-
"github.com/briandowns/spinner"
119
"github.com/cli/cli/internal/run"
1210
"github.com/cli/cli/pkg/browser"
1311
)
@@ -88,20 +86,6 @@ func Humanize(s string) string {
8886
return strings.Map(h, s)
8987
}
9088

91-
// We do this so we can stub out the spinner in tests -- it made things really flakey. This is not
92-
// an elegant solution.
93-
var StartSpinner = func(s *spinner.Spinner) {
94-
s.Start()
95-
}
96-
97-
var StopSpinner = func(s *spinner.Spinner) {
98-
s.Stop()
99-
}
100-
101-
func Spinner(w io.Writer) *spinner.Spinner {
102-
return spinner.New(spinner.CharSets[11], 400*time.Millisecond, spinner.WithWriter(w))
103-
}
104-
10589
func IsURL(s string) bool {
10690
return strings.HasPrefix(s, "http:/") || strings.HasPrefix(s, "https:/")
10791
}

0 commit comments

Comments
 (0)