1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-06 02:15:48 +03:00

chore: add print helper again and refactor some code

Expose the RedisClient directly instead of only being a property
This commit is contained in:
Ruben Bridgewater
2017-05-29 18:23:24 +02:00
parent 4e593587cb
commit 0276e15f04
14 changed files with 169 additions and 104 deletions

View File

@@ -2,9 +2,34 @@
const assert = require('assert')
const Queue = require('denque')
const intercept = require('intercept-stdout')
const utils = require('../lib/utils')
describe('utils.js', () => {
describe('print helper', function () {
it('callback with reply', function () {
var text = ''
const unhookIntercept = intercept(function (data) {
text += data
return ''
})
utils.print(null, 'abc')
unhookIntercept()
assert.strictEqual(text, 'Reply: abc\n')
})
it('callback with error', function () {
var text = ''
const unhookIntercept = intercept(function (data) {
text += data
return ''
})
utils.print(new Error('Wonderful exception'))
unhookIntercept()
assert.strictEqual(text, 'Error: Wonderful exception\n')
})
})
describe('clone', () => {
it('ignore the object prototype and clone a nested array / object', () => {
const obj = {