mirror of
https://github.com/fluencelabs/jsonpath
synced 2025-06-12 23:51:26 +00:00
Invalid wildcard filter results #7 - nodejs, wasm
This commit is contained in:
@ -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();
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user