You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-06 02:15:48 +03:00
test fixup
This commit is contained in:
@@ -1,50 +1,50 @@
|
||||
'use strict'
|
||||
|
||||
var assert = require('assert')
|
||||
var config = require('../lib/config')
|
||||
var helper = require('../helper')
|
||||
var redis = config.redis
|
||||
const assert = require('assert')
|
||||
const config = require('../lib/config')
|
||||
const helper = require('../helper')
|
||||
const redis = config.redis
|
||||
|
||||
describe('The \'info\' method', function () {
|
||||
helper.allTests(function (ip, args) {
|
||||
describe('using ' + ip, function () {
|
||||
var client
|
||||
describe('The \'info\' method', () => {
|
||||
helper.allTests((ip, args) => {
|
||||
describe(`using ${ip}`, () => {
|
||||
let client
|
||||
|
||||
beforeEach(function (done) {
|
||||
beforeEach((done) => {
|
||||
client = redis.createClient.apply(null, args)
|
||||
client.once('ready', function () {
|
||||
client.once('ready', () => {
|
||||
client.flushall(done)
|
||||
})
|
||||
})
|
||||
|
||||
afterEach(function () {
|
||||
afterEach(() => {
|
||||
client.end(true)
|
||||
})
|
||||
|
||||
it('update serverInfo after a info command', function (done) {
|
||||
it('update serverInfo after a info command', (done) => {
|
||||
client.set('foo', 'bar')
|
||||
client.info()
|
||||
client.select(2, function () {
|
||||
client.select(2, () => {
|
||||
assert.strictEqual(client.serverInfo.db2, undefined)
|
||||
})
|
||||
client.set('foo', 'bar')
|
||||
client.info()
|
||||
setTimeout(function () {
|
||||
setTimeout(() => {
|
||||
assert.strictEqual(typeof client.serverInfo.db2, 'object')
|
||||
done()
|
||||
}, 30)
|
||||
})
|
||||
|
||||
it('works with optional section provided with and without callback', function (done) {
|
||||
it('works with optional section provided with and without callback', (done) => {
|
||||
client.set('foo', 'bar')
|
||||
client.info('keyspace')
|
||||
client.select(2, function () {
|
||||
client.select(2, () => {
|
||||
assert.strictEqual(Object.keys(client.serverInfo).length, 2, 'Key length should be three')
|
||||
assert.strictEqual(typeof client.serverInfo.db0, 'object', 'db0 keyspace should be an object')
|
||||
})
|
||||
client.info(['keyspace'])
|
||||
client.set('foo', 'bar')
|
||||
client.info('all', function (err, res) {
|
||||
client.info('all', (err, res) => {
|
||||
assert.strictEqual(err, null)
|
||||
assert(Object.keys(client.serverInfo).length > 3, 'Key length should be way above three')
|
||||
assert.strictEqual(typeof client.serverInfo.redis_version, 'string')
|
||||
@@ -53,20 +53,20 @@ describe('The \'info\' method', function () {
|
||||
})
|
||||
})
|
||||
|
||||
it('check redis v.2.4 support', function (done) {
|
||||
var end = helper.callFuncAfter(done, 2)
|
||||
it('check redis v.2.4 support', (done) => {
|
||||
const end = helper.callFuncAfter(done, 2)
|
||||
client.internalSendCommand = function (commandObj) {
|
||||
assert.strictEqual(commandObj.args.length, 0)
|
||||
assert.strictEqual(commandObj.command, 'info')
|
||||
end()
|
||||
}
|
||||
client.info()
|
||||
client.info(function () {})
|
||||
client.info(() => {})
|
||||
})
|
||||
|
||||
it('emit error after a failure', function (done) {
|
||||
it('emit error after a failure', (done) => {
|
||||
client.info()
|
||||
client.once('error', function (err) {
|
||||
client.once('error', (err) => {
|
||||
assert.strictEqual(err.code, 'UNCERTAIN_STATE')
|
||||
assert.strictEqual(err.command, 'INFO')
|
||||
done()
|
||||
|
Reference in New Issue
Block a user