Skip to content

Commit

Permalink
feat: draft test for DownloadWithProgress
Browse files Browse the repository at this point in the history
  • Loading branch information
juev committed Dec 10, 2023
1 parent 34077fe commit 86845dd
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
2 changes: 1 addition & 1 deletion helpers_test.go
Expand Up @@ -224,7 +224,7 @@ func TestGoBrew_downloadAndExtract(t *testing.T) {
args args
}{
{
name: "",
name: "1.9",
args: args{
version: "1.9",
},
Expand Down
40 changes: 40 additions & 0 deletions utils/utils_test.go
@@ -0,0 +1,40 @@
package utils

import (
"net/http"
"net/http/httptest"
"net/url"
"testing"
)

func TestDownloadWithProgress(t *testing.T) {
t.Skip()
type args struct {
name string
destFolder string
}
tests := []struct {
name string
args args
wantErr bool
}{
{
name: "",
args: args{
name: "go1.9.darwin-arm64.tar.gz",
destFolder: t.TempDir(),
},
wantErr: false,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
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 {
t.Errorf("DownloadWithProgress() error = %v, wantErr %v", err, tt.wantErr)
}
})
}
}

0 comments on commit 86845dd

Please sign in to comment.