Skip to content

Commit b3ca540

Browse files
author
Aries Yuwono
committed
add test cases
1 parent 6d29736 commit b3ca540

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

test-complete/nodejs-xquery-invoke-params.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,41 @@ describe('Xquery invoke test', function(){
5151
}, done);
5252
});
5353

54+
it('should do xquery invoke with params on stream', function(done){
55+
dbEval.invoke(invokePath, {num1:2, num2:3}).
56+
stream().
57+
on('data', function(data) {
58+
//console.log(data);
59+
data.value.should.equal(5);
60+
}).
61+
on('end', function() {
62+
done();
63+
}, done);
64+
});
65+
66+
it('should do xquery invoke with params and transaction', function(done){
67+
var tid = 0;
68+
69+
dbEval.transactions.open({transactionName: 'invokeXqueryTransaction', timeLimit: 60})
70+
.result(function(response) {
71+
tid = response.txid;
72+
return dbEval.invoke({
73+
path: invokePath,
74+
variables: {num1:2, num2:3},
75+
txid: tid
76+
}).result();
77+
})
78+
.then(function(response) {
79+
//console.log(response);
80+
response[0].value.should.equal(5);
81+
return dbEval.transactions.commit(tid).result();
82+
})
83+
.then(function(response) {
84+
//console.log(response);
85+
done();
86+
}, done);
87+
});
88+
5489
it('should fail to do xquery invoke with wrong params value', function(done){
5590
dbEval.invoke(invokePath, {num1:'a', num2:3}).result(function(values) {
5691
//console.log(values);

0 commit comments

Comments
 (0)