Skip to content

Commit fd6670e

Browse files
committed
add failing test (complex keys)
1 parent 909456c commit fd6670e

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

test.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,19 @@ assert.equal(jsonpointer.get(obj, "/d/e/0/a"), 4);
3131
assert.equal(jsonpointer.get(obj, "/d/e/1/b"), 5);
3232
assert.equal(jsonpointer.get(obj, "/d/e/2/c"), 6);
3333

34+
var complexKeys = {
35+
"a/b": {
36+
c: 1
37+
},
38+
d: {
39+
"e/f": 2
40+
}
41+
}
42+
43+
assert.equal(jsonpointer.get(complexKeys, "/a%2Fb/c"), 1);
44+
assert.equal(jsonpointer.get(complexKeys, "/d/e%2Ff"), 2);
45+
assert.throws(function() {
46+
assert.equal(jsonpointer.get(complexKeys, "/a/b/c"), 1);
47+
});
48+
3449
console.log("All tests pass.");

0 commit comments

Comments
 (0)