add not functional tests for the shutdown handler

This commit is contained in:
Danny Arnold 2016-04-19 22:25:20 +02:00
parent 4161ceae4b
commit b7bc123741

View File

@ -12,10 +12,11 @@ function setupLogging(category, options) {
createClient: function(options) {
return {
config: options,
log: function(msg, tags) {
log: function(msg, tags, cb) {
msgs.push({
msg: msg,
tags: tags
tags: tags,
cb: cb
});
}
};
@ -107,4 +108,31 @@ vows.describe('log4js logglyAppender').addBatch({
assert.deepEqual(topic.results[0].tags, []);
}
}
}).addBatch({
'with shutdown callback': {
topic: function() {
var setup = setupTaggedLogging();
setup.logger.log('trace', 'Log event #1', 'Log 2', {
tags: ['tag1', 'tag2']
});
return setup;
},
'after the last message has been sent': {
topic: function (topic) {
var that = this;
log4js.shutdown(this.callback);
topic.results[0].cb();
setTimeout(function() {
that.callback(new Error('Shutdown callback has not been called'));
}, 0);
},
'calls `log4js.shutdown`s callback function.': function(error, result) {
assert.equal(error, undefined);
}
}
}
}).export(module);