Skip to content

Commit 5880467

Browse files
author
Afsin Ustundag
committed
code coverage
1 parent 32b7162 commit 5880467

File tree

3 files changed

+16
-23
lines changed

3 files changed

+16
-23
lines changed

lib/jsonave.js

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -259,12 +259,6 @@ var Tracer = {
259259
this.traceProperties(ps, accumulator);
260260
};
261261
},
262-
traceCommaDelimitedPropertiesGen: function (expr) {
263-
var properties = expr.split(',');
264-
return function (accumulator) {
265-
this.traceProperties(properties, accumulator);
266-
};
267-
},
268262
traceExpandedPropertiesGen: function (parameters) {
269263
return function (accumulator) {
270264
var obj = accumulator.currentObject();
@@ -474,21 +468,6 @@ exports.expression = (function () {
474468
var cache = {};
475469

476470
return function (inputObject) {
477-
if (inputObject.json === null || inputObject.json === undefined) {
478-
return inputObject.json;
479-
}
480-
481-
var opts = Object.keys(inputObject).reduce(function (r, key) {
482-
if ((key !== 'json') && (key !== 'path')) {
483-
r[key] = inputObject[key];
484-
}
485-
return r;
486-
}, {});
487-
if (!opts.hasOwnProperty('wrap')) {
488-
opts.wrap = true;
489-
}
490-
opts.emptyValue = [];
491-
var jp = instance(inputObject.path, opts);
492-
return jp(inputObject.json);
471+
return exports(inputObject);
493472
};
494473
})();

test/legacy/test.at_and_dollar.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ var t1 = {
2121
};
2222

2323
xdescribe('@ and $ test', function () {
24-
it('undefined, null', function () {
24+
xit('undefined, null', function () {
2525
expect(jsonPath({
2626
json: undefined,
2727
path: 'foo'

test/test-store.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,20 @@ describe('jsonpath store example default options', function () {
9393
expect(actual).to.deep.equal(expected);
9494
});
9595

96+
it('$.store.book[-2].price', function () {
97+
var jp = jsonpath.instance('$.store.book[-2].price');
98+
var actual = jp(store);
99+
var expected = 8.99;
100+
expect(actual).to.equal(expected);
101+
});
102+
103+
it('$.store.book[-2,-1].price', function () {
104+
var jp = jsonpath.instance('$.store.book[-2,-1]');
105+
var actual = jp(store);
106+
var expected = [store.store.book[2], store.store.book[3]];
107+
expect(actual).to.deep.equal(expected);
108+
});
109+
96110
it('$..book[*][category,author]', function () {
97111
var jp = jsonpath.instance('$..book[*][category,author]');
98112
var actual = jp(store);

0 commit comments

Comments
 (0)