1
0
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:
Ruben Bridgewater
2017-05-19 06:14:29 +02:00
parent b2613b2270
commit 6be5575c5b
85 changed files with 2081 additions and 3690 deletions

View File

@@ -10,24 +10,21 @@ describe('The \'slowlog\' 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('logs operations in slowlog', (done) => {
client.config('set', 'slowlog-log-slower-than', 0, helper.isString('OK'))
client.slowlog('reset', helper.isString('OK'))
client.set('foo', 'bar', helper.isString('OK'))
client.get('foo', helper.isString('bar'))
client.slowlog('get', (err, res) => {
it('logs operations in slowlog', () => {
client.config('set', 'slowlog-log-slower-than', 0).then(helper.isString('OK'))
client.slowlog('reset').then(helper.isString('OK'))
client.set('foo', 'bar').then(helper.isString('OK'))
client.get('foo').then(helper.isString('bar'))
return client.slowlog('get').then((res) => {
assert.strictEqual(res.length, 3)
assert.strictEqual(res[0][3].length, 2)
assert.deepEqual(res[1][3], ['set', 'foo', 'bar'])
assert.deepEqual(res[2][3], ['slowlog', 'reset'])
return done(err)
assert.deepStrictEqual(res[1][3], ['set', 'foo', 'bar'])
assert.deepStrictEqual(res[2][3], ['slowlog', 'reset'])
})
})