Skip to content

Commit 4edfddb

Browse files
author
Mike McCabe
committed
Merge branch 'master' of github.com:json-patch/json-patch-tests
2 parents 3151673 + 5dd935d commit 4edfddb

File tree

1 file changed

+43
-1
lines changed

1 file changed

+43
-1
lines changed

tests.json

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,5 +305,47 @@
305305
{ "comment": "test add with bad number should fail",
306306
"doc": ["foo", "sil"],
307307
"patch": [{"op": "add", "path": "/1e0", "value": "bar"}],
308-
"error": "add op shouldn't add to array with bad number" }
308+
"error": "add op shouldn't add to array with bad number" },
309+
310+
{ "comment": "missing 'value' parameter to add",
311+
"doc": [ 1 ],
312+
"patch": [ { "op": "add", "path": "/-" } ],
313+
"error": "missing 'value' parameter" },
314+
315+
{ "comment": "missing 'value' parameter to replace",
316+
"doc": [ 1 ],
317+
"patch": [ { "op": "replace", "path": "/0" } ],
318+
"error": "missing 'value' parameter" },
319+
320+
{ "comment": "missing 'value' parameter to test",
321+
"doc": [ null ],
322+
"patch": [ { "op": "test", "path": "/0" } ],
323+
"error": "missing 'value' parameter" },
324+
325+
{ "comment": "missing value parameter to test - where undef is falsy",
326+
"doc": [ false ],
327+
"patch": [ { "op": "test", "path": "/0" } ],
328+
"error": "missing 'value' parameter" },
329+
330+
{ "comment": "missing from parameter to copy",
331+
"doc": [ 1 ],
332+
"patch": [ { "op": "copy", "path": "/-" } ],
333+
"error": "missing 'from' parameter" },
334+
335+
{ "comment": "missing from parameter to move",
336+
"doc": { "foo": 1 },
337+
"patch": [ { "op": "move", "path": "" } ],
338+
"error": "missing 'from' parameter" },
339+
340+
{ "comment": "duplicate ops",
341+
"doc": { "foo": "bar" },
342+
"patch": [ { "op": "add", "path": "/baz", "value": "qux",
343+
"op": "move", "from":"/foo" } ],
344+
"error": "patch has two 'op' members",
345+
"disabled": true },
346+
347+
{ "comment": "unrecognized op should fail",
348+
"doc": {"foo": 1},
349+
"patch": [{"op": "spam", "path": "/foo", "value": 1}],
350+
"error": "Unrecognized op 'spam'" }
309351
]

0 commit comments

Comments
 (0)