Skip to content

Commit f644bac

Browse files
committed
Add jsondiff test cases
1 parent 066e2d4 commit f644bac

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

internal/jsondiff/jsondiff_test.go

+30
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,36 @@ func TestDiff(t *testing.T) {
317317
- 2,
318318
- 3
319319
- ]
320+
}`,
321+
wantKind: jsondiff.NoMatch,
322+
},
323+
{
324+
name: "object containing array containing object equal",
325+
a: `{"a": [1, {"b": 2}, 3]}`,
326+
b: `{"a": [1, {"b": 2}, 3]}`,
327+
wantDiff: ` {
328+
"a": [
329+
1,
330+
{
331+
"b": 2
332+
},
333+
3
334+
]
335+
}`,
336+
wantKind: jsondiff.Match,
337+
},
338+
{
339+
name: "object containing array containing object not equal",
340+
a: `{"a": [1, {"b": 2}, 3]}`,
341+
b: `{"a": [1, {"b": 4}, 3]}`,
342+
wantDiff: ` {
343+
"a": [
344+
1,
345+
{
346+
~ "b": 4 => 2
347+
},
348+
3
349+
]
320350
}`,
321351
wantKind: jsondiff.NoMatch,
322352
},

0 commit comments

Comments
 (0)