forked from JSONPath-Plus/JSONPath
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.toPointer.js
More file actions
35 lines (30 loc) · 1.27 KB
/
Copy pathtest.toPointer.js
File metadata and controls
35 lines (30 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/*global require, module*/
/*eslint-disable quotes*/
(function () {'use strict';
var jsonpath = require('../'),
testCase = require('nodeunit').testCase;
module.exports = testCase({
// ============================================================================
'toPointer': function (test) {
// ============================================================================
test.expect(1);
var expected = '/store/bicycle/color';
var result = jsonpath.toPointer(['$', 'store', 'bicycle', 'color']);
test.deepEqual(expected, result);
test.done();
},
// ============================================================================
'toPointer (stripped)': function (test) {
// ============================================================================
test.expect(3);
var expected = '/store/bicycle/color';
var result = jsonpath.toPointer(['$', 'store', 'bicycle', 'color', '^']);
test.deepEqual(expected, result);
result = jsonpath.toPointer(['$', 'store', 'bicycle', 'color', '@string()']);
test.deepEqual(expected, result);
result = jsonpath.toPointer(['$', 'store', 'bicycle', 'color', '~']);
test.deepEqual(expected, result);
test.done();
}
});
}());