You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-07 13:22:56 +03:00
chore: refactor codebase to promises
This commit is contained in:
@@ -9,26 +9,24 @@ describe('The \'renamenx\' 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('renames the key if target does not yet exist', (done) => {
|
||||
client.set('foo', 'bar', helper.isString('OK'))
|
||||
client.renamenx('foo', 'foo2', helper.isNumber(1))
|
||||
client.exists('foo', helper.isNumber(0))
|
||||
client.exists(['foo2'], helper.isNumber(1, done))
|
||||
it('renames the key if target does not yet exist', () => {
|
||||
client.set('foo', 'bar').then(helper.isString('OK'))
|
||||
client.renamenx('foo', 'foo2').then(helper.isNumber(1))
|
||||
client.exists('foo').then(helper.isNumber(0))
|
||||
return client.exists(['foo2']).then(helper.isNumber(1))
|
||||
})
|
||||
|
||||
it('does not rename the key if the target exists', (done) => {
|
||||
client.set('foo', 'bar', helper.isString('OK'))
|
||||
client.set('foo2', 'apple', helper.isString('OK'))
|
||||
client.renamenx('foo', 'foo2', helper.isNumber(0))
|
||||
client.exists('foo', helper.isNumber(1))
|
||||
client.exists(['foo2'], helper.isNumber(1, done))
|
||||
it('does not rename the key if the target exists', () => {
|
||||
client.set('foo', 'bar').then(helper.isString('OK'))
|
||||
client.set('foo2', 'apple').then(helper.isString('OK'))
|
||||
client.renamenx('foo', 'foo2').then(helper.isNumber(0))
|
||||
client.exists('foo').then(helper.isNumber(1))
|
||||
return client.exists(['foo2']).then(helper.isNumber(1))
|
||||
})
|
||||
|
||||
afterEach(() => {
|
||||
|
Reference in New Issue
Block a user