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 0 for "-P10Y10M"', () =>
chai.assert.equal(
evaluateXPathToNumber(
'hours-from-duration(xs:yearMonthDuration("-P10Y10M"))',
documentNode
),
0
));
});
it('returns the empty sequence if either operand is the empty sequence', () => {
chai.assert.equal(evaluateXPathToNumber('count(() is ())', documentNode), 0);
});
it('returns the empty sequence if the lhs operand is the empty sequence', () => {
it('accepts the empty sequence', () =>
chai.assert.isNaN(evaluateXPathToNumber('number(())', documentNode)));
it('get sum of sequence', () =>
chai.assert.deepEqual(
evaluateXPathToNumber(
'fold-left(1 to 5, 0, function($a, $b) {$a + $b})',
documentNode
),
15
));
it('reverse sequence', () =>
it('returns 24 for 24.5', () =>
chai.assert.equal(evaluateXPathToNumber('round-half-to-even(24.5)', documentNode), 24));
it('returns 26 for 25.5', () =>
it('also allows XQuery to be evaluated', () =>
chai.assert.equal(
evaluateXPathToNumber(
'fontoxpath:evaluate("declare default function namespace ""http://www.w3.org/2005/xpath-functions/math""; exp10(3)", map{})'
),
1000
));
});
it('is aliased to "executing the map function"', () =>
chai.assert.equal(
evaluateXPathToNumber('(map {"a": 1, "b":2})("a")', documentNode),
1
));
it('returns the empty sequence for an empty map', () =>
chai.assert.equal(evaluateXPathToNumber('count(map:keys(map{}))', documentNode), 0));
() => chai.assert.equal(evaluateXPathToNumber('round(xs:double("+INF"))', documentNode), +Infinity));
() => chai.assert.equal(evaluateXPathToNumber('+1', documentNode), 1));