You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-04 15:02:09 +03:00
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.
48 lines
1.3 KiB
JavaScript
48 lines
1.3 KiB
JavaScript
'use strict'
|
|
|
|
const config = require('../lib/config')
|
|
const helper = require('../helper')
|
|
|
|
const { redis } = config
|
|
|
|
describe('The \'expire\' method', () => {
|
|
helper.allTests((ip, args) => {
|
|
describe(`using ${ip}`, () => {
|
|
let client
|
|
|
|
beforeEach(() => {
|
|
client = redis.createClient.apply(null, args)
|
|
return client.flushdb()
|
|
})
|
|
|
|
it('expires key after timeout', () => {
|
|
return Promise.all([
|
|
client.set(['expiry key', 'bar']).then(helper.isString('OK')),
|
|
client.expire('expiry key', '1').then(helper.isNumber(1)),
|
|
new Promise((resolve, reject) => {
|
|
setTimeout(() => {
|
|
resolve(client.exists(['expiry key']).then(helper.isNumber(0)))
|
|
}, 1050)
|
|
})
|
|
])
|
|
})
|
|
|
|
it('expires key after timeout with array syntax', () => {
|
|
return Promise.all([
|
|
client.set(['expiry key', 'bar']).then(helper.isString('OK')),
|
|
client.expire(['expiry key', '1']).then(helper.isNumber(1)),
|
|
new Promise((resolve, reject) => {
|
|
setTimeout(() => {
|
|
resolve(client.exists(['expiry key']).then(helper.isNumber(0)))
|
|
}, 1050)
|
|
})
|
|
])
|
|
})
|
|
|
|
afterEach(() => {
|
|
client.end(true)
|
|
})
|
|
})
|
|
})
|
|
})
|