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

@@ -12,37 +12,34 @@ describe('The \'watch\' method', () => {
describe(`using ${ip}`, () => {
let client
beforeEach((done) => {
beforeEach(() => {
client = redis.createClient.apply(null, args)
client.once('ready', () => {
client.flushdb(done)
})
return client.flushdb()
})
afterEach(() => {
client.end(true)
})
it('does not execute transaction if watched key was modified prior to execution', (done) => {
it('does not execute transaction if watched key was modified prior to execution', () => {
client.watch(watched)
client.incr(watched)
const multi = client.multi()
multi.incr(watched)
multi.exec(helper.isNull(done))
return multi.exec().then(helper.isNull())
})
it('successfully modifies other keys independently of transaction', (done) => {
it('successfully modifies other keys independently of transaction', () => {
client.set('unwatched', 200)
client.set(watched, 0)
client.watch(watched)
client.incr(watched)
client.multi().incr(watched).exec((err, replies) => {
assert.strictEqual(err, null)
return client.multi().incr(watched).exec().then((replies) => {
assert.strictEqual(replies, null, 'Aborted transaction multi-bulk reply should be null.')
client.get('unwatched', helper.isString('200', done))
return client.get('unwatched').then(helper.isString('200'))
})
})
})