Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,19 @@ object JsonDiffSpec : WordSpec({
assertThat(diff, isEmpty)
}

"not return mismatch for arrays containing equal objects with different field order" {
val firstJson = "json-with-array-of-objects1.json".loadAsJsonTree()
val secondJson = "json-with-array-of-objects2.json".loadAsJsonTree()

val comparator = jsonComparator {
compareArraysUnordered()
}

val diff = comparator.diff(firstJson, secondJson)

assertThat(diff, isEmpty)
}

"not return mismatch for permutation-based array comparison on arrays with different sort order" {
val firstJson = "json-with-array.json".loadAsJsonTree()
val secondJson = "json-with-array-reversed.json".loadAsJsonTree()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"myArray": [
{
"a": 1,
"z": 1
},
{
"a": 2,
"z": 2
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"myArray": [
{
"a": 2,
"z": 2
},
{
"z": 1,
"a": 1
}
]
}