jsonpath/nodejs/test/index.spec.js

30 lines
674 B
JavaScript
Raw Normal View History

2019-03-14 22:30:42 +09:00
const jsonpath = require('../lib/index.js');
describe('compile test', () => {
it('basic', (done) => {
let template = jsonpath.compile('$.a');
let result = template({'a': 1});
if (result === 1) {
2019-03-14 22:30:42 +09:00
done();
}
});
});
describe('selector test', () => {
it('basic', (done) => {
let selector = jsonpath.selector({'a': 1});
let result = selector('$.a');
if (result === 1) {
2019-03-14 22:30:42 +09:00
done();
}
});
});
describe('select test', () => {
it('basic', (done) => {
let result = jsonpath.select({'a': 1}, '$.a');
if (result === 1) {
2019-03-14 22:30:42 +09:00
done();
}
});
});