Skip to content

Commit

Permalink
fix: tests for DownloadWithProgress and downloadAndExtract
Browse files Browse the repository at this point in the history
  • Loading branch information
juev committed Dec 11, 2023
1 parent 86845dd commit e9ff7bd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
4 changes: 2 additions & 2 deletions helpers_test.go
Expand Up @@ -214,7 +214,6 @@ func Test_doRequest(t *testing.T) {
}

func TestGoBrew_downloadAndExtract(t *testing.T) {
t.Skip()
t.Parallel()
type args struct {
version string
Expand All @@ -232,11 +231,12 @@ func TestGoBrew_downloadAndExtract(t *testing.T) {
}
for _, tt := range tests {
tt := tt
gb := NewGoBrew(t.TempDir())
gb.mkDirs("1.9")
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
ts := httptest.NewServer(http.FileServer(http.Dir("testdata")))
defer ts.Close()
gb := NewGoBrew(t.TempDir())
gb.downloadAndExtract(ts.URL+"/", tt.args.version)
})
}
Expand Down
12 changes: 7 additions & 5 deletions utils/utils_test.go
Expand Up @@ -8,7 +8,7 @@ import (
)

func TestDownloadWithProgress(t *testing.T) {
t.Skip()
t.Parallel()
type args struct {
name string
destFolder string
Expand All @@ -21,18 +21,20 @@ func TestDownloadWithProgress(t *testing.T) {
{
name: "",
args: args{
name: "go1.9.darwin-arm64.tar.gz",
name: "/go1.9.darwin-arm64.tar.gz",
destFolder: t.TempDir(),
},
wantErr: false,
},
}
for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
ts := httptest.NewServer(http.FileServer(http.Dir("testdata")))
t.Parallel()
ts := httptest.NewServer(http.FileServer(http.Dir("../testdata")))
defer ts.Close()
url, _ := url.JoinPath(ts.URL, tt.args.name)
if err := DownloadWithProgress(url, tt.args.name, tt.args.destFolder); (err != nil) != tt.wantErr {
path, _ := url.JoinPath(ts.URL, tt.args.name)
if err := DownloadWithProgress(path, tt.args.name, tt.args.destFolder); (err != nil) != tt.wantErr {
t.Errorf("DownloadWithProgress() error = %v, wantErr %v", err, tt.wantErr)
}
})
Expand Down

0 comments on commit e9ff7bd

Please sign in to comment.