Skip to content

Commit fb82683

Browse files
committed
test update
1 parent 9308d46 commit fb82683

File tree

3 files changed

+27
-5
lines changed

3 files changed

+27
-5
lines changed

lib/connection.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ TarantoolConnection.prototype.update = function(spaceId, indexId, key, ops){
456456

457457
TarantoolConnection.prototype.upsert = function(spaceId, ops, tuple){
458458
return new Promise(function (resolve, reject) {
459-
if (Array.isArray(ops) && Array.isArray(key)){
459+
if (Array.isArray(ops)){
460460
if (typeof(spaceId)=='string')
461461
{
462462
return this._getMetadata(spaceId, 0)
@@ -482,7 +482,7 @@ TarantoolConnection.prototype.upsert = function(spaceId, ops, tuple){
482482
this.commandsQueue.push([tarantoolConstants.RequestCode.rqUpsert, reqId, {resolve: resolve, reject: reject}]);
483483
}
484484
else
485-
reject(new Error('need array'));
485+
reject(new Error('need ops array'));
486486
}.bind(this));
487487
};
488488

test/app.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ describe('Tarantool Connection tests', function(){
272272
}
273273
});
274274
it('insert', function(done){
275-
conn.upsert('upstest', 1, [['+', 3, 3]], [1, 2, 3])
275+
conn.upsert('upstest', [['+', 3, 3]], [1, 2, 3])
276276
.then(function() {
277277
return conn.select('upstest', 'primary', 1, 0, 'eq', 1);
278278
})
@@ -287,9 +287,9 @@ describe('Tarantool Connection tests', function(){
287287
});
288288
});
289289
it('update', function(done){
290-
conn.upsert('upstest', 2, [['+', 2, 2]], [2, 4, 3])
290+
conn.upsert('upstest', [['+', 2, 2]], [2, 4, 3])
291291
.then(function(){
292-
return conn.upsert('upstest', 2, [['+', 2, 2]], [2, 4, 3]);
292+
return conn.upsert('upstest', [['+', 2, 2]], [2, 4, 3]);
293293
})
294294
.then(function() {
295295
return conn.select('upstest', 'primary', 1, 0, 'eq', 2) ;

test/box.lua

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,25 @@ function clearaddmore()
8383
end
8484
end
8585
end
86+
87+
if not box.schema.func.exists('clearaddmore') then
88+
box.schema.func.create('clearaddmore')
89+
box.schema.user.grant('test', 'execute', 'function', 'clearaddmore')
90+
end
91+
if not box.schema.func.exists('myget') then
92+
box.schema.func.create('myget')
93+
box.schema.user.grant('test', 'execute', 'function', 'myget')
94+
end
95+
if not box.schema.func.exists('batch') then
96+
box.schema.func.create('batch')
97+
box.schema.user.grant('test', 'execute', 'function', 'batch')
98+
end
99+
if not box.schema.func.exists('myprint') then
100+
box.schema.func.create('myprint')
101+
box.schema.user.grant('test', 'execute', 'function', 'myprint')
102+
end
103+
if not box.schema.func.exists('test_delete') then
104+
box.schema.func.create('test_delete')
105+
box.schema.user.grant('test', 'execute', 'function', 'test_delete')
106+
end
107+

0 commit comments

Comments
 (0)