You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-06 02:15:48 +03:00
Unify command handling
This commit is contained in:
@@ -199,8 +199,8 @@ describe("The 'batch' method", function () {
|
||||
arr4,
|
||||
[["mset", "batchfoo2", "batchbar2", "batchfoo3", "batchbar3"], helper.isString('OK')],
|
||||
["hmset", arr],
|
||||
[["hmset", "batchhmset2", "batchbar2", "batchfoo3", "batchbar3", "test", helper.isString('OK')]],
|
||||
["hmset", ["batchhmset", "batchbar", "batchfoo", helper.isString('OK')]],
|
||||
[["hmset", "batchhmset2", "batchbar2", "batchfoo3", "batchbar3", "test"], helper.isString('OK')],
|
||||
["hmset", ["batchhmset", "batchbar", "batchfoo"], helper.isString('OK')],
|
||||
["hmset", arr3, helper.isString('OK')],
|
||||
['hmset', now, {123456789: "abcdefghij", "some manner of key": "a type of value", "otherTypes": 555}],
|
||||
['hmset', 'key2', {"0123456789": "abcdefghij", "some manner of key": "a type of value", "otherTypes": 999}, helper.isString('OK')],
|
||||
@@ -211,8 +211,9 @@ describe("The 'batch' method", function () {
|
||||
.hmget('key2', arr2, function noop() {})
|
||||
.hmget(['batchhmset2', 'some manner of key', 'batchbar3'])
|
||||
.mget('batchfoo2', ['batchfoo3', 'batchfoo'], function(err, res) {
|
||||
assert(res[0], 'batchfoo3');
|
||||
assert(res[1], 'batchfoo');
|
||||
assert.strictEqual(res[0], 'batchbar2');
|
||||
assert.strictEqual(res[1], 'batchbar3');
|
||||
assert.strictEqual(res[2], null);
|
||||
})
|
||||
.exec(function (err, replies) {
|
||||
assert.equal(arr.length, 3);
|
||||
@@ -273,7 +274,7 @@ describe("The 'batch' method", function () {
|
||||
it('allows multiple commands to work the same as normal to be performed using a chaining API', function (done) {
|
||||
client.batch()
|
||||
.mset(['some', '10', 'keys', '20'])
|
||||
.incr(['some', helper.isNumber(11)])
|
||||
.incr('some', helper.isNumber(11))
|
||||
.incr(['keys'], helper.isNumber(21))
|
||||
.mget('some', 'keys')
|
||||
.exec(function (err, replies) {
|
||||
@@ -290,7 +291,7 @@ describe("The 'batch' method", function () {
|
||||
it('allows multiple commands to work the same as normal to be performed using a chaining API promisified', function () {
|
||||
return client.batch()
|
||||
.mset(['some', '10', 'keys', '20'])
|
||||
.incr(['some', helper.isNumber(11)])
|
||||
.incr('some', helper.isNumber(11))
|
||||
.incr(['keys'], helper.isNumber(21))
|
||||
.mget('some', 'keys')
|
||||
.execAsync()
|
||||
|
@@ -75,13 +75,6 @@ describe("The 'get' method", function () {
|
||||
});
|
||||
});
|
||||
|
||||
it("gets the value correctly with array syntax and the callback being in the array", function (done) {
|
||||
client.GET([key, function (err, res) {
|
||||
helper.isString(value)(err, res);
|
||||
done(err);
|
||||
}]);
|
||||
});
|
||||
|
||||
it("should not throw on a get without callback (even if it's not useful)", function (done) {
|
||||
client.GET(key);
|
||||
client.on('error', function(err) {
|
||||
|
@@ -64,7 +64,7 @@ describe("The 'hgetall' method", function () {
|
||||
|
||||
it('returns binary results', function (done) {
|
||||
client.hmset(["bhosts", "mjr", "1", "another", "23", "home", "1234", new Buffer([0xAA, 0xBB, 0x00, 0xF0]), new Buffer([0xCC, 0xDD, 0x00, 0xF0])], helper.isString("OK"));
|
||||
client.HGETALL(["bhosts", function (err, obj) {
|
||||
client.HGETALL("bhosts", function (err, obj) {
|
||||
assert.strictEqual(4, Object.keys(obj).length);
|
||||
assert.strictEqual("1", obj.mjr.toString());
|
||||
assert.strictEqual("23", obj.another.toString());
|
||||
@@ -72,7 +72,7 @@ describe("The 'hgetall' method", function () {
|
||||
assert.strictEqual((new Buffer([0xAA, 0xBB, 0x00, 0xF0])).toString('binary'), Object.keys(obj)[3]);
|
||||
assert.strictEqual((new Buffer([0xCC, 0xDD, 0x00, 0xF0])).toString('binary'), obj[(new Buffer([0xAA, 0xBB, 0x00, 0xF0])).toString('binary')].toString('binary'));
|
||||
return done(err);
|
||||
}]);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
@@ -89,7 +89,7 @@ describe("The 'mset' method", function () {
|
||||
|
||||
it("sets the value correctly with array syntax", function (done) {
|
||||
client.mset([key, value2, key2, value]);
|
||||
client.get([key, helper.isString(value2)]);
|
||||
client.get(key, helper.isString(value2));
|
||||
client.get(key2, helper.isString(value, done));
|
||||
});
|
||||
});
|
||||
|
@@ -330,8 +330,8 @@ describe("The 'multi' method", function () {
|
||||
arr4,
|
||||
[["mset", "multifoo2", "multibar2", "multifoo3", "multibar3"], helper.isString('OK')],
|
||||
["hmset", arr],
|
||||
[["hmset", "multihmset2", "multibar2", "multifoo3", "multibar3", "test", helper.isString('OK')]],
|
||||
["hmset", ["multihmset", "multibar", "multifoo", helper.isString('OK')]],
|
||||
[["hmset", "multihmset2", "multibar2", "multifoo3", "multibar3", "test"], helper.isString('OK')],
|
||||
["hmset", ["multihmset", "multibar", "multifoo"], helper.isString('OK')],
|
||||
["hmset", arr3, helper.isString('OK')],
|
||||
['hmset', now, {123456789: "abcdefghij", "some manner of key": "a type of value", "otherTypes": 555}],
|
||||
['hmset', 'key2', {"0123456789": "abcdefghij", "some manner of key": "a type of value", "otherTypes": 999}, helper.isString('OK')],
|
||||
@@ -399,7 +399,7 @@ describe("The 'multi' method", function () {
|
||||
it('allows multiple commands to work the same as normal to be performed using a chaining API', function (done) {
|
||||
client.multi()
|
||||
.mset(['some', '10', 'keys', '20'])
|
||||
.incr(['some', helper.isNumber(11)])
|
||||
.incr('some', helper.isNumber(11))
|
||||
.incr(['keys'], helper.isNumber(21))
|
||||
.mget('some', 'keys')
|
||||
.exec(function (err, replies) {
|
||||
@@ -416,7 +416,7 @@ describe("The 'multi' method", function () {
|
||||
it('allows multiple commands to work the same as normal to be performed using a chaining API promisified', function () {
|
||||
return client.multi()
|
||||
.mset(['some', '10', 'keys', '20'])
|
||||
.incr(['some', helper.isNumber(11)])
|
||||
.incr('some', helper.isNumber(11))
|
||||
.incr(['keys'], helper.isNumber(21))
|
||||
.mget('some', 'keys')
|
||||
.execAsync()
|
||||
|
Reference in New Issue
Block a user