1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-04 15:02:09 +03:00
Files
node-redis/test/commands/hmget.spec.js
Ruben Bridgewater 2b4ab10305 chore - remove standard and use individual config
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.
2017-11-28 21:38:21 -02:00

52 lines
1.7 KiB
JavaScript

'use strict'
const config = require('../lib/config')
const helper = require('../helper')
const { redis } = config
describe('The \'hmget\' method', () => {
helper.allTests((ip, args) => {
describe(`using ${ip}`, () => {
let client
const hash = 'test hash'
beforeEach(() => {
client = redis.createClient.apply(null, args)
client.flushdb()
return client.hmset(hash, { '0123456789': 'abcdefghij', 'some manner of key': 'a type of value' })
.then(helper.isString('OK'))
})
it('allows keys to be specified using multiple arguments', () => {
return client.hmget(hash, '0123456789', 'some manner of key')
.then(helper.isDeepEqual(['abcdefghij', 'a type of value']))
})
it('allows keys to be specified by passing an array without manipulating the array', () => {
const data = ['0123456789', 'some manner of key']
return client.hmget(hash, data)
.then(helper.isDeepEqual(['abcdefghij', 'a type of value']))
})
it('allows keys to be specified by passing an array as first argument', () => {
return client.hmget([hash, '0123456789', 'some manner of key'])
.then(helper.isDeepEqual(['abcdefghij', 'a type of value']))
})
it('allows a single key to be specified in an array', () => {
return client.hmget(hash, ['0123456789']).then(helper.isDeepEqual(['abcdefghij']))
})
it('allows keys to be specified that have not yet been set', () => {
return client.hmget(hash, 'missing thing', 'another missing thing')
.then(helper.isDeepEqual([null, null]))
})
afterEach(() => {
client.end(true)
})
})
})
})