Skip to content

Commit

Permalink
Fix unreliable test
Browse files Browse the repository at this point in the history
  • Loading branch information
bombsimon committed Oct 1, 2023
1 parent ed0c80e commit 94e7c95
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions inferrer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (

jtd "github.com/jsontypedef/json-typedef-go"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

func TestJTDInfer(t *testing.T) {
Expand Down Expand Up @@ -49,6 +50,17 @@ func TestJTDInferrerWithEnumHints(t *testing.T) {
}
gotSchema := InferStrings(rows, hints).IntoSchema(hints)

// We check that we got the same elements in our enum first and then we
// delete it since the order is unreliable due to being a map.
require.ElementsMatch(
t,
expectedSchema.Properties["address"].Properties["city"].Enum,
gotSchema.Properties["address"].Properties["city"].Enum,
)

delete(expectedSchema.Properties, "address")
delete(gotSchema.Properties, "address")

assert.EqualValues(t, expectedSchema, gotSchema)
}

Expand Down

0 comments on commit 94e7c95

Please sign in to comment.