cli/compose/loader: use golden.Assert() for readability

golden.AssertBytes prints the failure as a bytes-array, which makes
it not human-readable; let's compare strings instead.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2024-01-08 13:51:52 +01:00
parent 5c6ca07208
commit 26f59b2f66
No known key found for this signature in database
GPG Key ID: 76698F39D527CE8C
1 changed files with 2 additions and 2 deletions

View File

@ -17,7 +17,7 @@ func TestMarshallConfig(t *testing.T) {
actual, err := yaml.Marshal(cfg) actual, err := yaml.Marshal(cfg)
assert.NilError(t, err) assert.NilError(t, err)
golden.AssertBytes(t, actual, "full-example.yaml.golden") golden.Assert(t, string(actual), "full-example.yaml.golden")
// Make sure the expected can be parsed. // Make sure the expected can be parsed.
yamlData, err := os.ReadFile("testdata/full-example.yaml.golden") yamlData, err := os.ReadFile("testdata/full-example.yaml.golden")
@ -34,7 +34,7 @@ func TestJSONMarshallConfig(t *testing.T) {
cfg := fullExampleConfig(workingDir, homeDir) cfg := fullExampleConfig(workingDir, homeDir)
actual, err := json.MarshalIndent(cfg, "", " ") actual, err := json.MarshalIndent(cfg, "", " ")
assert.NilError(t, err) assert.NilError(t, err)
golden.AssertBytes(t, actual, "full-example.json.golden") golden.Assert(t, string(actual), "full-example.json.golden")
jsonData, err := os.ReadFile("testdata/full-example.json.golden") jsonData, err := os.ReadFile("testdata/full-example.json.golden")
assert.NilError(t, err) assert.NilError(t, err)