@@ -18,7 +18,7 @@ function setupLogging(category, options) {
18
18
createClient : function ( port , post , optionR ) {
19
19
return {
20
20
on : function ( event , callback ) {
21
- callback ( 'thow one redis error' ) ;
21
+ callback ( 'throw redis error #1 ' ) ;
22
22
} ,
23
23
publish : function ( channel , message , callback ) {
24
24
msgs . push ( { channel : channel , message : message } ) ;
@@ -39,6 +39,12 @@ function setupLogging(category, options) {
39
39
messagePassThroughLayout : log4js . layouts . messagePassThroughLayout
40
40
} ;
41
41
42
+ const fakeUtil = {
43
+ inspect : function ( item ) {
44
+ return JSON . stringify ( item ) ;
45
+ }
46
+ } ;
47
+
42
48
const fakeConsole = {
43
49
errors : [ ] ,
44
50
logs : [ ] ,
@@ -53,7 +59,8 @@ function setupLogging(category, options) {
53
59
const redisModule = sandbox . require ( '../../lib/appenders/redis' , {
54
60
requires : {
55
61
'redis' : fakeRedis ,
56
- '../layouts' : fakeLayouts
62
+ '../layouts' : fakeLayouts ,
63
+ util : fakeUtil
57
64
} ,
58
65
globals : {
59
66
console : fakeConsole
@@ -116,12 +123,12 @@ test('log4js redisAppender', (batch) => {
116
123
} ) ;
117
124
118
125
batch . test ( 'config with layout' , ( t ) => {
119
- const setup = setupLogging ( 'config with layout' , {
126
6EA0
+ const result = setupLogging ( 'config with layout' , {
120
127
layout : {
121
128
type : 'tester'
122
129
}
123
130
} ) ;
124
- t . equal ( setup . layouts . type , 'tester' , 'should configure layout' ) ;
131
+ t . equal ( result . layouts . type , 'tester' , 'should configure layout' ) ;
125
132
t . end ( ) ;
126
133
} ) ;
127
134
0 commit comments