Skip to content

Commit

Permalink
Remove AssertGoldenBytes test helper
Browse files Browse the repository at this point in the history
The test suite is thereby simplified somewhat.

Signed-off-by: Simon Alling <alling.simon@gmail.com>
  • Loading branch information
SimonAlling committed Dec 13, 2021
1 parent 8ca4013 commit dd5db7b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
11 changes: 1 addition & 10 deletions internal/test/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,6 @@ type HelperT interface {
Helper()
}

// AssertGoldenBytes asserts that the give actual content matches the contents of the given filename
func AssertGoldenBytes(t TestingT, actual []byte, filename string) {
t.Helper()

if err := compare(actual, path(filename)); err != nil {
t.Fatalf("%v", err)
}
}

// AssertGoldenString asserts that the given string matches the contents of the given file.
func AssertGoldenString(t TestingT, actual, filename string) {
t.Helper()
Expand All @@ -66,7 +57,7 @@ func AssertGoldenFile(t TestingT, actualFileName string, expectedFilename string
if err != nil {
t.Fatalf("%v", err)
}
AssertGoldenBytes(t, actual, expectedFilename)
AssertGoldenString(t, string(actual), expectedFilename)
}

func path(filename string) string {
Expand Down
2 changes: 1 addition & 1 deletion pkg/action/dependency_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func TestList(t *testing.T) {
if err := NewDependency().List(tcase.chart, &buf); err != nil {
t.Fatal(err)
}
test.AssertGoldenBytes(t, buf.Bytes(), tcase.golden)
test.AssertGoldenString(t, buf.String(), tcase.golden)
}
}

Expand Down

0 comments on commit dd5db7b

Please sign in to comment.