Skip to content

Commit

Permalink
openapi3(tests): use testify's YAMLEq function (#954)
Browse files Browse the repository at this point in the history
  • Loading branch information
percivalalb authored Jun 2, 2024
1 parent 2cf1262 commit f170f8c
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions openapi3/openapi3_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,18 +82,9 @@ func TestRefsYAML(t *testing.T) {
require.NoError(t, err)
dataB, err := yaml.Marshal(docB)
require.NoError(t, err)
eqYAML(t, data, specYAML)
eqYAML(t, data, dataA)
eqYAML(t, data, dataB)
}

func eqYAML(t *testing.T, expected, actual []byte) {
var e, a interface{}
err := yaml.Unmarshal(expected, &e)
require.NoError(t, err)
err = yaml.Unmarshal(actual, &a)
require.NoError(t, err)
require.Equal(t, e, a)
require.YAMLEq(t, string(data), string(specYAML))
require.YAMLEq(t, string(data), string(dataA))
require.YAMLEq(t, string(data), string(dataB))
}

var specYAML = []byte(`
Expand Down

0 comments on commit f170f8c

Please sign in to comment.