You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"multi-element array does not contain itself permuted": {`["alpha", "beta"]`, `["beta" ,"alpha"]`, []string{
496
-
"expected string at '$[0]' to be 'beta' but was 'alpha'",
497
-
"expected string at '$[1]' to be 'alpha' but was 'beta'",
498
-
}},
495
+
// NOTE: There's an important design decision to be made here.
496
+
// Currently, in the case of "Containsf" there's an implicit "<<UNORDERED>>" (if it's explicitly written it will be ignored)
497
+
// This is so that nested arrays don't have to repeatedly say "<<UNORDERED">> assuming the user just wants to check for the existence of some element of an array.
498
+
// However, this makes jsonassert useless for cases where you want to partially assert that an ordered array exists.
499
+
// Ideally this package should be able to support both nicely.
// Allow users to test against a subset of the payload without erroring out.
500
502
// This is to avoid the frustraion and unintuitive solution of adding "<<UNORDERED>>" in order to "enable" subsetting,
501
503
// which is really implied with the `contains` part of the API name.
502
-
"multi-element array does contain its subset": {`["alpha", "beta"]`, `["alpha"]`, []string{}},
504
+
"multi-element array does contain its subset": {`["alpha", "beta"]`, `["beta"]`, []string{}},
503
505
"multi-element array does not contain its superset": {`["alpha", "beta"]`, `["alpha", "beta", "gamma"]`, []string{"length of expected array at '$' was longer (length 3) than the actual array (length 2)", `actual JSON at '$' was: ["alpha","beta"], but expected JSON to contain: ["alpha","beta","gamma"]`}},
504
506
"expected and actual have different types": {`{"foo": "bar"}`, `null`, []string{"actual JSON (object) and expected JSON (null) were of different types at '$'"}},
505
507
"expected any value but got null": {`{"foo": null}`, `{"foo": "<<PRESENCE>>"}`, []string{"expected the presence of any value at '$.foo', but was absent"}},
506
508
"unordered multi-element array of different types contains subset": {`["alpha", 5, false, ["foo"], {"bar": "baz"}]`, `["<<UNORDERED>>", 5, "alpha", {"bar": "baz"}]`, nil},
0 commit comments