1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-04 15:02:09 +03:00
Files
node-redis/test/commands/zadd.spec.js
Ruben Bridgewater 2b4ab10305 chore - remove standard and use individual config
Standard is not as up to date and still uses a old eslint version.
Instead, use the airbnb default with a couple of modifications.

All required changes are included.
2017-11-28 21:38:21 -02:00

44 lines
1.5 KiB
JavaScript

'use strict'
const config = require('../lib/config')
const helper = require('../helper')
const assert = require('assert')
const { redis } = config
describe('The \'zadd\' method', () => {
helper.allTests((ip, args) => {
describe(`using ${ip}`, () => {
let client
beforeEach(() => {
client = redis.createClient.apply(null, args)
return client.flushdb()
})
it('reports an error', function () {
if (helper.redisProcess().spawnFailed()) this.skip()
return client.zadd('infinity', [+'5t', 'should not be possible']).then(assert, helper.isError())
})
it('return inf / -inf', function () {
if (helper.redisProcess().spawnFailed()) this.skip()
helper.serverVersionAtLeast.call(this, client, [3, 0, 2])
client.zadd('infinity', [+Infinity, 'should be inf']).then(helper.isNumber(1))
client.zadd('infinity', ['inf', 'should be also be inf']).then(helper.isNumber(1))
client.zadd('infinity', -Infinity, 'should be negative inf').then(helper.isNumber(1))
client.zadd('infinity', [99999999999999999999999, 'should not be inf']).then(helper.isNumber(1))
return client.zrange('infinity', 0, -1, 'WITHSCORES').then((res) => {
assert.strictEqual(res[5], 'inf')
assert.strictEqual(res[1], '-inf')
assert.strictEqual(res[3], '9.9999999999999992e+22')
})
})
afterEach(() => {
client.end(true)
})
})
})
})