You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-06 02:15:48 +03:00
chore: refactor codebase to promises
This commit is contained in:
@@ -10,31 +10,27 @@ describe('The \'zadd\' method', () => {
|
||||
describe(`using ${ip}`, () => {
|
||||
let client
|
||||
|
||||
beforeEach((done) => {
|
||||
beforeEach(() => {
|
||||
client = redis.createClient.apply(null, args)
|
||||
client.once('ready', () => {
|
||||
client.flushdb(done)
|
||||
})
|
||||
return client.flushdb()
|
||||
})
|
||||
|
||||
it('reports an error', function (done) {
|
||||
it('reports an error', function () {
|
||||
if (helper.redisProcess().spawnFailed()) this.skip()
|
||||
client.zadd('infinity', [+'5t', 'should not be possible'], helper.isError(done))
|
||||
return client.zadd('infinity', [+'5t', 'should not be possible']).then(assert, helper.isError())
|
||||
})
|
||||
|
||||
it('return inf / -inf', function (done) {
|
||||
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'], 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', (err, res) => {
|
||||
assert.strictEqual(err, null)
|
||||
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')
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
||||
|
Reference in New Issue
Block a user