discord-baymax-bot/node_modules/log4js/test/vows/consoleAppender-test.js

34 lines
805 B
JavaScript
Raw Normal View History

2017-03-24 04:52:08 +00:00
"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);