Skip to content

Commit

Permalink
tests: standardize gomega imports
Browse files Browse the repository at this point in the history
  • Loading branch information
cpanato committed Mar 21, 2020
1 parent d66ced6 commit 9c03e0a
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions cmd/clusterctl/client/repository/repository_github_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ package repository
import (
"fmt"
"net/http"
"reflect"
"testing"

. "github.com/onsi/gomega"
Expand Down Expand Up @@ -231,6 +230,8 @@ func Test_gitHubRepository_getReleaseByTag(t *testing.T) {
}

func Test_gitHubRepository_downloadFilesFromRelease(t *testing.T) {
g := NewWithT(t)

client, mux, teardown := test.NewFakeGitHub()
defer teardown()

Expand Down Expand Up @@ -313,23 +314,19 @@ func Test_gitHubRepository_downloadFilesFromRelease(t *testing.T) {
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
g, err := newGitHubRepository(providerConfig, configVariablesClient)
if err != nil {
t.Fatal(err)
}
g.injectClient = client
gRepo, err := newGitHubRepository(providerConfig, configVariablesClient)
g.Expect(err).NotTo(HaveOccurred())

got, err := g.downloadFilesFromRelease(tt.args.release, tt.args.fileName)
if (err != nil) != tt.wantErr {
t.Fatalf("error = %v, wantErr %v", err, tt.wantErr)
}
gRepo.injectClient = client

got, err := gRepo.downloadFilesFromRelease(tt.args.release, tt.args.fileName)
if tt.wantErr {
g.Expect(err).To(HaveOccurred())
return
}

if !reflect.DeepEqual(got, tt.want) {
t.Errorf("got = %v, want %v", got, tt.want)
}
g.Expect(err).NotTo(HaveOccurred())
g.Expect(got).To(Equal(tt.want))
})
}
}
Expand Down

0 comments on commit 9c03e0a

Please sign in to comment.