improved coverage for console appender
This commit is contained in:
parent
4a8f0580de
commit
fc7f686f65
33
test/consoleAppender-test.js
Normal file
33
test/consoleAppender-test.js
Normal file
@ -0,0 +1,33 @@
|
||||
"use strict";
|
||||
var assert = require('assert')
|
||||
, vows = require('vows')
|
||||
, layouts = require('../lib/layouts')
|
||||
, sandbox = require('sandboxed-module');
|
||||
|
||||
vows.describe('../lib/appenders/console').addBatch({
|
||||
'appender': {
|
||||
topic: function() {
|
||||
var messages = []
|
||||
, fakeConsole = {
|
||||
log: function(msg) { messages.push(msg); }
|
||||
}
|
||||
, appenderModule = sandbox.require(
|
||||
'../lib/appenders/console',
|
||||
{
|
||||
globals: {
|
||||
'console': fakeConsole
|
||||
}
|
||||
}
|
||||
)
|
||||
, appender = appenderModule.appender(layouts.messagePassThroughLayout);
|
||||
|
||||
appender({ data: ["blah"] });
|
||||
return messages;
|
||||
},
|
||||
|
||||
'should output to console': function(messages) {
|
||||
assert.equal(messages[0], 'blah');
|
||||
}
|
||||
}
|
||||
|
||||
}).exportTo(module);
|
Loading…
Reference in New Issue
Block a user