8000 Update redisAppender-test.js · LikeABossProgrammer/log4js-node@3452566 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3452566

Browse files
authored
Update redisAppender-test.js
1 parent 1cfc4eb commit 3452566

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

test/tap/redisAppender-test.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ function setupLogging(category, options) {
1818
createClient: function (port, post, optionR) {
1919
return {
2020
on: function (event, callback) {
21-
callback('thow one redis error');
21+
callback('throw redis error #1');
2222
},
2323
publish: function (channel, message, callback) {
2424
msgs.push({channel: channel, message: message});
@@ -39,6 +39,12 @@ function setupLogging(category, options) {
3939
messagePassThroughLayout: log4js.layouts.messagePassThroughLayout
4040
};
4141

42+
const fakeUtil = {
43+
inspect: function (item) {
44+
return JSON.stringify(item);
45+
}
46+
};
47+
4248
const fakeConsole = {
4349
errors: [],
4450
logs: [],
@@ -53,7 +59,8 @@ function setupLogging(category, options) {
5359
const redisModule = sandbox.require('../../lib/appenders/redis', {
5460
requires: {
5561
'redis': fakeRedis,
56-
'../layouts': fakeLayouts
62+
'../layouts': fakeLayouts,
63+
util: fakeUtil
5764
},
5865
globals: {
5966
console: fakeConsole
@@ -116,12 +123,12 @@ test('log4js redisAppender', (batch) => {
116123
});
117124

118125
batch.test('config with layout', (t) => {
119-
const setup = setupLogging('config with layout', {
126 6EA0 +
const result = setupLogging('config with layout', {
120127
layout: {
121128
type: 'tester'
122129
}
123130
});
124-
t.equal(setup.layouts.type, 'tester', 'should configure layout');
131+
t.equal(result.layouts.type, 'tester', 'should configure layout');
125132
t.end();
126133
});
127134

0 commit comments

Comments
 (0)
0