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});
|
2019-03-18 10:59:08 +09:00
|
|
|
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');
|
2019-03-18 10:59:08 +09:00
|
|
|
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');
|
2019-03-18 10:59:08 +09:00
|
|
|
if (result === 1) {
|
2019-03-14 22:30:42 +09:00
|
|
|
done();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|