Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('returns the full array if the range is full', () =>
chai.assert.deepEqual(
evaluateXPathToArray('array:subarray([1,2,3], 1, 3)', documentNode),
[1, 2, 3]
));
it('can be parsed', () =>
chai.assert.isOk(
evaluateXPathToArray('array {1, 2}', documentNode),
'It should be able to be parsed'
));
it('can be filled async', async () => {
it('appends an item to an empty array', () =>
chai.assert.deepEqual(evaluateXPathToArray('array:append([], 0)', documentNode), [0]));
it('can read a map value twice from within a function', () =>
chai.assert.deepEqual(
evaluateXPathToArray(
`declare function local:func($some-map) {
[$some-map("k"), $some-map("k")]
};
local:func($my-map)`,
null,
null,
{ 'my-map': { k: 'val' } },
{ language: evaluateXPath.XQUERY_3_1_LANGUAGE }
),
['val', 'val']
));
() => chai.assert.isOk(evaluateXPathToArray('array {1, 2}', documentNode)), 'It should be able to be parsed');
it('can be filled async', async () => {
it('inserts before the last item', () =>
chai.assert.deepEqual(
evaluateXPathToArray('array:insert-before([1,2,3], 3, "a")', documentNode),
[1, 2, 'a', 3]
));
it('returns the result of calling the function for each item', () =>
chai.assert.deepEqual(
evaluateXPathToArray(
'array:for-each([("the cat"),"sat",("on the mat")], function ($x) { tokenize($x) => reverse() => string-join(" ")})',
documentNode
),
['cat the', 'sat', 'mat the on']
));
it('inserts before the first item', () =>
chai.assert.deepEqual(
evaluateXPathToArray('array:insert-before([1,2,3], 1, "a")', documentNode),
['a', 1, 2, 3]
));
it('sorts the array', () =>
chai.assert.deepEqual(evaluateXPathToArray('array:sort([3,2,1])', documentNode), [
1,
2,
3
]));
() => evaluateXPathToArray('array:put([1,2,3], 0, "a")', documentNode),
'FOAY0001'