From dd5db7bc40679d82e00977d12d67aed617b1376d Mon Sep 17 00:00:00 2001 From: Simon Alling Date: Mon, 13 Dec 2021 10:52:59 +0100 Subject: [PATCH] Remove AssertGoldenBytes test helper The test suite is thereby simplified somewhat. Signed-off-by: Simon Alling --- internal/test/test.go | 11 +---------- pkg/action/dependency_test.go | 2 +- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/internal/test/test.go b/internal/test/test.go index 646037606..0de3210c4 100644 --- a/internal/test/test.go +++ b/internal/test/test.go @@ -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() @@ -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 { diff --git a/pkg/action/dependency_test.go b/pkg/action/dependency_test.go index b5032a377..a46a461a0 100644 --- a/pkg/action/dependency_test.go +++ b/pkg/action/dependency_test.go @@ -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) } }