Skip to content

Commit d09884a

Browse files
committed
- Testing: Improve coverage (manual evaluate)
1 parent ede60c2 commit d09884a

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

test/test.api.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,23 @@ describe('JSONPath - API', function () {
5252
result = jsonpath({json, path: 'store.book[*].author'});
5353
assert.deepEqual(result, expected);
5454
});
55+
56+
it('should test defaults on manual `evaluate` with `autostart: false`', () => {
57+
const books = json.store.book;
58+
const expected = [books[0].author, books[1].author, books[2].author, books[3].author];
59+
let jp = jsonpath({
60+
path: '$.store.book[*].author',
61+
json,
62+
autostart: false
63+
});
64+
let result = jp.evaluate();
65+
assert.deepEqual(result, expected);
66+
jp = jsonpath({
67+
json,
68+
path: 'store.book[*].author',
69+
autostart: false
70+
});
71+
result = jp.evaluate();
72+
assert.deepEqual(result, expected);
73+
});
5574
});

0 commit comments

Comments
 (0)