mirror of https://github.com/docker/cli.git
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:
parent
5c6ca07208
commit
26f59b2f66
|
@ -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)
|
||||||
|
|
Loading…
Reference in New Issue