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

Fix a test and add some more

This commit is contained in:
Ruben Bridgewater
2015-09-30 02:04:56 +02:00
parent fba050802b
commit afcd760b18
4 changed files with 110 additions and 9 deletions

View File

@@ -0,0 +1,44 @@
'use strict';
var config = require("../lib/config");
var helper = require("../helper");
var assert = require('assert');
var redis = config.redis;
describe("The 'zadd' method", function () {
helper.allTests(function(parser, ip, args) {
describe.only("using " + parser + " and " + ip, function () {
var client;
beforeEach(function (done) {
client = redis.createClient.apply(redis.createClient, args);
client.once("connect", function () {
client.flushdb(done);
});
});
it('reports an error', function (done) {
client.zadd('infinity', [+'5t', "should not be possible"], helper.isError(done));
});
it('return inf / -inf', function (done) {
client.zadd('infinity', [+Infinity, "should 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');
assert.equal(res[1], '-inf');
assert.equal(res[3], '9.9999999999999992e+22');
done();
});
});
afterEach(function () {
client.end();
});
});
});
});