kinbiko / jsonassert

A Go test assertion library for verifying that two representations of JSON are semantically equal
MIT License
127 stars 16 forks source link

Support unordered arrays #31

Closed kinbiko closed 3 years ago

kinbiko commented 3 years ago

What problem are you trying to solve?

It's not possible to use this package to make assertions against payloads that have arrays that aren't deterministic in their ordering.

Describe how you wish this package would help you solve the problem

Expose a directive similar to <<PRESENCE>> that can be added as the first element of the array in order to ignore ordering.

// should pass
ja.Assertf(`["foo", "bar"]`, `["<<UNORDERED>>", "bar", "foo"]`)

References

This issue was created based on the request from @blaskovicz on #25.