File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change 55
66 jtd "github.com/jsontypedef/json-typedef-go"
77 "github.com/stretchr/testify/assert"
8+ "github.com/stretchr/testify/require"
89)
910
1011func TestJTDInfer (t * testing.T ) {
@@ -49,6 +50,17 @@ func TestJTDInferrerWithEnumHints(t *testing.T) {
4950 }
5051 gotSchema := InferStrings (rows , hints ).IntoSchema (hints )
5152
53+ // We check that we got the same elements in our enum first and then we
54+ // delete it since the order is unreliable due to being a map.
55+ require .ElementsMatch (
56+ t ,
57+ expectedSchema .Properties ["address" ].Properties ["city" ].Enum ,
58+ gotSchema .Properties ["address" ].Properties ["city" ].Enum ,
59+ )
60+
61+ delete (expectedSchema .Properties , "address" )
62+ delete (gotSchema .Properties , "address" )
63+
5264 assert .EqualValues (t , expectedSchema , gotSchema )
5365}
5466
You can’t perform that action at this time.
0 commit comments