You've already forked node-redis
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:
@@ -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 = {
|
||||
|
Reference in New Issue
Block a user