mirror of
https://github.com/log4js-node/log4js-node.git
synced 2025-12-08 19:26:01 +00:00
add not functional tests for the shutdown handler
This commit is contained in:
parent
4161ceae4b
commit
b7bc123741
@ -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);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user