Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add failing test (complex keys)

  • Loading branch information...
commit fd6670ee9c4b9b6ab42b19c224cc05f7e5130a33 1 parent 909456c
@benatkin benatkin authored
Showing with 15 additions and 0 deletions.
  1. +15 −0 test.js
View
15 test.js
@@ -31,4 +31,19 @@ assert.equal(jsonpointer.get(obj, "/d/e/0/a"), 4);
assert.equal(jsonpointer.get(obj, "/d/e/1/b"), 5);
assert.equal(jsonpointer.get(obj, "/d/e/2/c"), 6);
+var complexKeys = {
+ "a/b": {
+ c: 1
+ },
+ d: {
+ "e/f": 2
+ }
+}
+
+assert.equal(jsonpointer.get(complexKeys, "/a%2Fb/c"), 1);
+assert.equal(jsonpointer.get(complexKeys, "/d/e%2Ff"), 2);
+assert.throws(function() {
+ assert.equal(jsonpointer.get(complexKeys, "/a/b/c"), 1);
+});
+
console.log("All tests pass.");
Please sign in to comment.
Something went wrong with that request. Please try again.