🔥 utils.Spinner
This commit is contained in:
parent
aa0de5f636
commit
a2bee1fad3
3 changed files with 0 additions and 32 deletions
|
|
@ -8,7 +8,6 @@ import (
|
|||
"os/exec"
|
||||
"testing"
|
||||
|
||||
"github.com/briandowns/spinner"
|
||||
"github.com/cli/cli/internal/config"
|
||||
"github.com/cli/cli/internal/ghrepo"
|
||||
"github.com/cli/cli/internal/run"
|
||||
|
|
@ -16,7 +15,6 @@ import (
|
|||
"github.com/cli/cli/pkg/httpmock"
|
||||
"github.com/cli/cli/pkg/iostreams"
|
||||
"github.com/cli/cli/test"
|
||||
"github.com/cli/cli/utils"
|
||||
"github.com/google/shlex"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
|
@ -404,7 +402,6 @@ func TestIssueView_tty_Comments(t *testing.T) {
|
|||
}
|
||||
for name, tc := range tests {
|
||||
t.Run(name, func(t *testing.T) {
|
||||
stubSpinner()
|
||||
http := &httpmock.Registry{}
|
||||
defer http.Verify(t)
|
||||
for name, file := range tc.fixtures {
|
||||
|
|
@ -496,8 +493,3 @@ func TestIssueView_nontty_Comments(t *testing.T) {
|
|||
})
|
||||
}
|
||||
}
|
||||
|
||||
func stubSpinner() {
|
||||
utils.StartSpinner = func(_ *spinner.Spinner) {}
|
||||
utils.StopSpinner = func(_ *spinner.Spinner) {}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ import (
|
|||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/briandowns/spinner"
|
||||
"github.com/cli/cli/context"
|
||||
"github.com/cli/cli/git"
|
||||
"github.com/cli/cli/internal/config"
|
||||
|
|
@ -19,7 +18,6 @@ import (
|
|||
"github.com/cli/cli/pkg/httpmock"
|
||||
"github.com/cli/cli/pkg/iostreams"
|
||||
"github.com/cli/cli/test"
|
||||
"github.com/cli/cli/utils"
|
||||
"github.com/google/shlex"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
|
@ -777,7 +775,6 @@ func TestPRView_tty_Comments(t *testing.T) {
|
|||
}
|
||||
for name, tt := range tests {
|
||||
t.Run(name, func(t *testing.T) {
|
||||
stubSpinner()
|
||||
http := &httpmock.Registry{}
|
||||
defer http.Verify(t)
|
||||
for name, file := range tt.fixtures {
|
||||
|
|
@ -873,8 +870,3 @@ func TestPRView_nontty_Comments(t *testing.T) {
|
|||
})
|
||||
}
|
||||
}
|
||||
|
||||
func stubSpinner() {
|
||||
utils.StartSpinner = func(_ *spinner.Spinner) {}
|
||||
utils.StopSpinner = func(_ *spinner.Spinner) {}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,12 +2,10 @@ package utils
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"net/url"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/briandowns/spinner"
|
||||
"github.com/cli/cli/internal/run"
|
||||
"github.com/cli/cli/pkg/browser"
|
||||
)
|
||||
|
|
@ -88,20 +86,6 @@ func Humanize(s string) string {
|
|||
return strings.Map(h, s)
|
||||
}
|
||||
|
||||
// We do this so we can stub out the spinner in tests -- it made things really flakey. This is not
|
||||
// an elegant solution.
|
||||
var StartSpinner = func(s *spinner.Spinner) {
|
||||
s.Start()
|
||||
}
|
||||
|
||||
var StopSpinner = func(s *spinner.Spinner) {
|
||||
s.Stop()
|
||||
}
|
||||
|
||||
func Spinner(w io.Writer) *spinner.Spinner {
|
||||
return spinner.New(spinner.CharSets[11], 400*time.Millisecond, spinner.WithWriter(w))
|
||||
}
|
||||
|
||||
func IsURL(s string) bool {
|
||||
return strings.HasPrefix(s, "http:/") || strings.HasPrefix(s, "https:/")
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue