You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-09 00:22:08 +03:00
30 lines
730 B
JavaScript
30 lines
730 B
JavaScript
'use strict'
|
|
|
|
const assert = require('assert')
|
|
const config = require('../lib/config')
|
|
const helper = require('../helper')
|
|
const redis = config.redis
|
|
|
|
describe('The \'setex\' method', () => {
|
|
helper.allTests((ip, args) => {
|
|
describe(`using ${ip}`, () => {
|
|
let client
|
|
|
|
beforeEach(() => {
|
|
client = redis.createClient.apply(null, args)
|
|
return client.flushdb()
|
|
})
|
|
|
|
it('sets a key with an expiry', () => {
|
|
client.setex(['setex key', '100', 'setex val']).then(helper.isString('OK'))
|
|
client.exists(['setex key']).then(helper.isNumber(1))
|
|
return client.ttl(['setex key']).then(assert)
|
|
})
|
|
|
|
afterEach(() => {
|
|
client.end(true)
|
|
})
|
|
})
|
|
})
|
|
})
|