Skip to content

Commit 4db5098

Browse files
committed
Added a test for replacing the root of the doc
The "add" op with an empty "path" should replace the whole document.
1 parent 994ed8a commit 4db5098

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

tests.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,5 +248,10 @@
248248
"patch": [{"op": "copy", "from": "/baz/0", "path": "/boo"}],
249249
"expected": {"baz":[{"qux":"hello"}],"bar":1,"boo":{"qux":"hello"}} },
250250

251+
{ "comment": "replacing the root of the document is possible with add",
252+
"doc": {"foo": "bar"},
253+
"patch": [{"op": "add", "path": "", "value": {"baz": "qux"}}],
254+
"expected": {"baz":"qux"}},
255+
251256
{ "comment": "tests complete" }
252257
]

0 commit comments

Comments
 (0)