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.
37 lines
934 B
JavaScript
37 lines
934 B
JavaScript
'use strict'
|
|
|
|
const { Buffer } = require('buffer')
|
|
const config = require('../lib/config')
|
|
const helper = require('../helper')
|
|
|
|
const { redis } = config
|
|
|
|
describe('The \'hlen\' method', () => {
|
|
helper.allTests((ip, args) => {
|
|
describe(`using ${ip}`, () => {
|
|
let client
|
|
|
|
beforeEach(() => {
|
|
client = redis.createClient.apply(null, args)
|
|
return client.flushdb()
|
|
})
|
|
|
|
it('reports the count of keys', () => {
|
|
const hash = 'test hash'
|
|
const field1 = Buffer.from('0123456789')
|
|
const value1 = Buffer.from('abcdefghij')
|
|
const field2 = Buffer.from('')
|
|
const value2 = Buffer.from('')
|
|
|
|
client.hset(hash, field1, value1).then(helper.isNumber(1))
|
|
client.hset(hash, field2, value2).then(helper.isNumber(1))
|
|
return client.hlen(hash).then(helper.isNumber(2))
|
|
})
|
|
|
|
afterEach(() => {
|
|
client.end(true)
|
|
})
|
|
})
|
|
})
|
|
})
|