You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-10 11:43:01 +03:00
30 lines
744 B
JavaScript
30 lines
744 B
JavaScript
'use strict'
|
|
|
|
const config = require('../lib/config')
|
|
const helper = require('../helper')
|
|
const redis = config.redis
|
|
|
|
describe('The \'spop\' method', () => {
|
|
helper.allTests((ip, args) => {
|
|
describe(`using ${ip}`, () => {
|
|
let client
|
|
|
|
beforeEach(() => {
|
|
client = redis.createClient.apply(null, args)
|
|
return client.flushdb()
|
|
})
|
|
|
|
it('returns a random element from the set', () => {
|
|
client.sadd('zzz', 'member0').then(helper.isNumber(1))
|
|
client.scard('zzz').then(helper.isNumber(1))
|
|
client.spop('zzz').then(helper.isString('member0'))
|
|
return client.scard('zzz').then(helper.isNumber(0))
|
|
})
|
|
|
|
afterEach(() => {
|
|
client.end(true)
|
|
})
|
|
})
|
|
})
|
|
})
|