mirror of
https://github.com/fluencelabs/jsonpath
synced 2025-04-01 06:21:06 +00:00
30 lines
674 B
JavaScript
30 lines
674 B
JavaScript
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) {
|
|
done();
|
|
}
|
|
});
|
|
});
|
|
|
|
describe('selector test', () => {
|
|
it('basic', (done) => {
|
|
let selector = jsonpath.selector({'a': 1});
|
|
let result = selector('$.a');
|
|
if (result === 1) {
|
|
done();
|
|
}
|
|
});
|
|
});
|
|
|
|
describe('select test', () => {
|
|
it('basic', (done) => {
|
|
let result = jsonpath.select({'a': 1}, '$.a');
|
|
if (result === 1) {
|
|
done();
|
|
}
|
|
});
|
|
}); |