Skip to content

Commit

Permalink
- Testing: Add more at-sign tests
Browse files Browse the repository at this point in the history
  • Loading branch information
brettz9 committed Apr 9, 2020
1 parent 6352d88 commit 3bbf4eb
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
2 changes: 1 addition & 1 deletion badges/tests-badge.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions test/test.properties.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,28 @@ checkBuiltInVMAndNodeVM(function (vmType, setBuiltInState) {
}, path: "$.datafield[?(@.tag=='xxx')]", wrap: false});
assert.deepEqual(result, undefined);
});

it('Checking properties of child object (through `@` as parent object)', function () {
const jsonObj = {
test1: {
a: 4,
b: 8
}
};
const result = jsonpath({
json: jsonObj, path: "$.[?(@.a == 4)]", wrap: false});
assert.deepEqual(result, [jsonObj.test1]);
});
it('Checking properties of child object (through `@` as property)', function () {
const jsonObj = {
test1: {
a: 4,
b: 8
}
};
const result = jsonpath({
json: jsonObj, path: "$.[?(@property == 'a' && @ == 4)]^", wrap: false});
assert.deepEqual(result, [jsonObj.test1]);
});
});
});

0 comments on commit 3bbf4eb

Please sign in to comment.