Skip to content

Commit b100515

Browse files
committed
Add test for dot access after string key bracket access
1 parent 1204c8d commit b100515

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

test/path-translator.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,21 @@ describe("validation plugin - path translator", function(){
6565
expect(transformPathToArray(path, jsSpec)).toEqual(["definitions", "One.Two"])
6666
})
6767

68+
it("should translate paths separated by brackets with string keys, and then periods", function() {
69+
// Given
70+
let jsSpec = {
71+
definitions: {
72+
"One.Two": {
73+
a: "1"
74+
}
75+
}
76+
}
77+
let path = "instance.definitions[\"One.Two\"].abc123"
78+
79+
// Then
80+
expect(transformPathToArray(path, jsSpec)).toEqual(["definitions", "One.Two", "abc123"])
81+
})
82+
6883
it("should translate an doubly ambiguous string path to an array", function(){
6984
// Since JSONSchema uses periods to mark different properties,
7085
// a key with two periods in it (like "www.google.com") is doubly ambiguous,

0 commit comments

Comments
 (0)