You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-07 13:22:56 +03:00
Accept hmset being used without a callback. Closes #694
This commit is contained in:
@@ -45,6 +45,42 @@ describe("The 'hmset' method", function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('allows a numeric key without callback', function (done) {
|
||||
client.HMSET(hash, 99, 'banana', 'test', 25);
|
||||
client.HGETALL(hash, function (err, obj) {
|
||||
assert.equal(obj['99'], 'banana');
|
||||
assert.equal(obj['test'], '25');
|
||||
return done(err);
|
||||
});
|
||||
});
|
||||
|
||||
it('allows an array without callback', function (done) {
|
||||
client.HMSET([hash, 99, 'banana', 'test', 25]);
|
||||
client.HGETALL(hash, function (err, obj) {
|
||||
assert.equal(obj['99'], 'banana');
|
||||
assert.equal(obj['test'], '25');
|
||||
return done(err);
|
||||
});
|
||||
});
|
||||
|
||||
it('allows an array and a callback', function (done) {
|
||||
client.HMSET([hash, 99, 'banana', 'test', 25], helper.isString('OK'));
|
||||
client.HGETALL(hash, function (err, obj) {
|
||||
assert.equal(obj['99'], 'banana');
|
||||
assert.equal(obj['test'], '25');
|
||||
return done(err);
|
||||
});
|
||||
});
|
||||
|
||||
it('handles object-style syntax without callback', function (done) {
|
||||
client.HMSET(hash, {"0123456789": "abcdefghij", "some manner of key": "a type of value"});
|
||||
client.HGETALL(hash, function (err, obj) {
|
||||
assert.equal(obj['0123456789'], 'abcdefghij');
|
||||
assert.equal(obj['some manner of key'], 'a type of value');
|
||||
return done(err);
|
||||
})
|
||||
});
|
||||
|
||||
afterEach(function () {
|
||||
client.end();
|
||||
});
|
||||
|
Reference in New Issue
Block a user