Appendix A.14 of the spec specifies that the result of applying a "test" op should be the input JSON document, not a non-JSON raw Boolean.
However, as the README states and this lib behaves, if the last op in a JSONPatch document is a test, the result of require('json-patch').apply(ops, in) is a Boolean.
This script should succeed without error, but throws an AssertionError for the above reason.
var jsonPatch = require('json-patch');
var assert = require('chai').assert;
// Testing http://tools.ietf.org/html/rfc6902#appendix-A.14
var exampleTarget = {
"/": 9,
"~1": 10
};
var patch = [
{ "op": "test", "path": "/~01", "value": 10 }
];
var expectedResult = {
"/": 9,
"~1": 10
};
assert.deepEqual(jsonPatch.apply(exampleTarget, patch), expectedResult);
Appendix A.14 of the spec specifies that the result of applying a "test" op should be the input JSON document, not a non-JSON raw Boolean.
However, as the README states and this lib behaves, if the last op in a JSONPatch document is a test, the result of
require('json-patch').apply(ops, in)
is a Boolean.This script should succeed without error, but throws an AssertionError for the above reason.