Merge pull request #4760 from thaJeztah/improve_asserts

cli/compose/loader: use golden.Assert() for readability
This commit is contained in:
Sebastiaan van Stijn 2024-01-08 16:59:16 +01:00 committed by GitHub
commit cfe18f5e03
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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)