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

chore: use standard

This commit is contained in:
Ruben Bridgewater
2017-05-06 07:06:52 +02:00
parent 5d29f541e9
commit f1a7bcd735
106 changed files with 10706 additions and 10978 deletions

View File

@@ -1,48 +1,46 @@
'use strict';
'use strict'
var config = require('../lib/config');
var helper = require('../helper');
var assert = require('assert');
var redis = config.redis;
var config = require('../lib/config')
var helper = require('../helper')
var assert = require('assert')
var redis = config.redis
describe("The 'zadd' method", function () {
describe('The \'zadd\' method', function () {
helper.allTests(function (ip, args) {
describe('using ' + ip, function () {
var client
helper.allTests(function (ip, args) {
beforeEach(function (done) {
client = redis.createClient.apply(null, args)
client.once('ready', function () {
client.flushdb(done)
})
})
describe('using ' + ip, function () {
var client;
it('reports an error', function (done) {
if (helper.redisProcess().spawnFailed()) this.skip()
client.zadd('infinity', [+'5t', 'should not be possible'], helper.isError(done))
})
beforeEach(function (done) {
client = redis.createClient.apply(null, args);
client.once('ready', function () {
client.flushdb(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', ['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.strictEqual(err, null)
assert.strictEqual(res[5], 'inf')
assert.strictEqual(res[1], '-inf')
assert.strictEqual(res[3], '9.9999999999999992e+22')
done()
})
})
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', ['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');
assert.equal(res[1], '-inf');
assert.equal(res[3], '9.9999999999999992e+22');
done();
});
});
afterEach(function () {
client.end(true);
});
});
});
});
afterEach(function () {
client.end(true)
})
})
})
})