1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-06 02:15:48 +03:00

Merge remote branch 'tj/features/multi'

Conflicts:
	test.js
This commit is contained in:
Matt Ranney
2010-09-24 10:51:21 -07:00
2 changed files with 65 additions and 37 deletions

35
test.js
View File

@@ -343,8 +343,6 @@ tests.SETEX = function () {
client.ttl(["setex key"], last(name, require_number_pos(name)));
};
// plenty of tests of MSET already
tests.MSETNX = function () {
var name = "MSETNX";
client.mset(["mset1", "val1", "mset2", "val2", "mset3", "val3"], require_string("OK", name));
@@ -355,6 +353,39 @@ tests.MSETNX = function () {
client.exists(["mset4"], last(name, require_number(1, name)));
};
tests.MULTI_4 = function () {
var name = "MULTI_4";
client.multi
.mset('some', '10', 'keys', '20')
.incr('some')
.incr('keys')
.mget('some', 'keys')
.exec(function(err, replies){
assert.strictEqual(null, err);
assert.equal('OK', replies[0]);
assert.equal(11, replies[1]);
assert.equal(21, replies[2]);
assert.equal(11, replies[3][0].toString());
assert.equal(21, replies[3][1].toString());
next(name);
});
};
tests.MULTI_ERROR = function () {
var name = "MULTI_ERROR";
client
.multi
.set('something', 'amazing')
.set('invalid')
.exec(function(err, replies){
assert.equal("ERR wrong number of arguments for 'set' command", err.message);
assert.strictEqual(undefined, replies);
next(name);
});
};
tests.HGETALL = function () {
var name = "HGETALL";
client.hmset(["hosts", "mjr", "1", "another", "23", "home", "1234"], require_string("OK", name));