Closed xamenyap closed 4 years ago
From json.org:
An array is an ordered collection of values.
In order for two JSON arrays to be deemed equal they must have the same length and their items at each index should also be deemed equal (ordering is part of the assertion). So, the assertion above must fail.
@xamenyap - Glad you're enjoying the libraries!
thanks for the explanation 👍
Hi, thanks for the awesome lib :)
I just found a small issue with
ShouldEqualJSON
. The sample test below will failIt looks like under the hood it's comparing two string
[{"id": 1, "sku": "sku-123"}, {"id": 2, "sku": "sku-456"}]
and[{"id": 2, "sku": "sku-456"}, {"id": 1, "sku": "sku-123"}]
, hence the failed test. Is this the expected behavior ofShouldEqualJSON
? Right now I can bypass this by unmarshalling the json array and compare their elements, but it would be nice if we can have some assertions function to do this. What do you think?