Invalid wildcard filter results #7 - nodejs, wasm

This commit is contained in:
freestrings
2019-06-23 18:56:30 +09:00
parent 6d38c67e90
commit 967df1b787
10 changed files with 108 additions and 44 deletions

View File

@ -903,4 +903,36 @@ describe('ISSUE test', () => {
done();
}
});
it('Invalid wildcard filter results #7', (done) => {
function select(json, expected, paths) {
for (var i = 0 ; i < paths.length ; i++) {
let result = jsonpath.select(json, paths[i]);
if (JSON.stringify(result) !== JSON.stringify(expected)) {
throw Error("Error: " + paths[i]);
}
}
}
select(
["string", 42, { "key": "value" }, [0, 1]],
["string", 42, { "key": "value" }, [0, 1]],
["$.*", "$[*]"]
);
select(
["string", 42, { "key": "value" }, [0, 1]],
[ "string", 42, { "key" : "value" }, [ 0, 1 ], "value", 0, 1 ],
["$..*", "$..[*]"]
);
select(
["string", 42, { "key": "value" }, [0, 1]],
["value", 0, 1],
["$.*.*", "$[*].*", "$.*[*]", "$[*][*]"]
);
done();
});
});