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

Fix explicitly passing undefined as callback

This commit is contained in:
Ruben Bridgewater
2015-10-02 20:20:56 +02:00
parent 977d4dba2b
commit 2ca42417bf
7 changed files with 240 additions and 218 deletions

View File

@@ -4,7 +4,7 @@ var config = require("../lib/config");
var helper = require("../helper");
var redis = config.redis;
describe("The 'getoadd' method", function () {
describe("The 'geoadd' method", function () {
helper.allTests(function(parser, ip, args) {
@@ -19,6 +19,7 @@ describe("The 'getoadd' method", function () {
});
it('returns 1 if the key exists', function (done) {
helper.serverVersionAtLeast.call(this, client, [3, 2, 0]);
client.geoadd("mycity:21:0:location", "13.361389","38.115556","COR", function(err, res) {
console.log(err, res);
// geoadd is still in the unstable branch. As soon as it reaches the stable one, activate this test

View File

@@ -89,6 +89,16 @@ describe("The 'set' method", function () {
}, 100);
});
it("sets the value correctly even if the callback is explicitly set to undefined", function (done) {
client.set(key, value, undefined);
setTimeout(function () {
client.get(key, function (err, res) {
helper.isString(value)(err, res);
done();
});
}, 100);
});
it("sets the value correctly with the array syntax", function (done) {
client.set([key, value]);
setTimeout(function () {

View File

@@ -20,12 +20,16 @@ describe("The 'zadd' method", function () {
});
it('reports an error', function (done) {
if (helper.redisProcess().spawnFailed()) this.skip();
client.zadd('infinity', [+'5t', "should not be possible"], helper.isError(done));
});
it('return inf / -inf', function (done) {
if (helper.redisProcess().spawnFailed()) this.skip();
helper.serverVersionAtLeast.call(this, client, [3, 0, 2]);
client.zadd('infinity', [+Infinity, "should be inf"], helper.isNumber(1));
client.zadd('infinity', [-Infinity, "should be negative inf"], helper.isNumber(1));
client.zadd('infinity', ['inf', 'should be also be inf'], helper.isNumber(1));
client.zadd('infinity', -Infinity, "should be negative inf", helper.isNumber(1));
client.zadd('infinity', [99999999999999999999999, "should not be inf"], helper.isNumber(1));
client.zrange('infinity', 0, -1, 'WITHSCORES', function (err, res) {
assert.equal(res[5], 'inf');