Skip to content

Commit

Permalink
Added test for 'error' emit when it swaps to silent
Browse files Browse the repository at this point in the history
I added a test to check that transport emit an 'error' message when it
reaches the maximum connection retries and it swaps to ```silent``` mode
  • Loading branch information
ifraixedes committed Nov 13, 2013
1 parent 1cd910c commit 71bf69e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/winston-logstash_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,15 @@ describe('winston-logstash transport', function() {
expect(logger.transports.logstash.silent).to.be.true;
done();
});
});

it('emit an error message when it fallback to silent mode', function(done) {
logger.transports.logstash.on('error', function (err) {
if (/OFFLINE$/.test(err.message)) {
expect(logger.transports.logstash.retries).to.be.equal(4);
expect(logger.transports.logstash.silent).to.be.true;
}
});
});
});

Expand Down

0 comments on commit 71bf69e

Please sign in to comment.