Skip to content

Commit

Permalink
chore: restructure logger tests
Browse files Browse the repository at this point in the history
  • Loading branch information
maverick1872 committed Jan 30, 2022
1 parent 29a9ff7 commit 23d9036
Show file tree
Hide file tree
Showing 2 changed files with 545 additions and 599 deletions.
21 changes: 21 additions & 0 deletions tests/unit/winston/create-logger.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const winston = require("../../../lib/winston");
const assume = require("assume");
const isStream = require("is-stream");
const {format} = require("../../../lib/winston");
const TransportStream = require("winston-transport");

describe('Create Logger', function () {
it('should build a logger with default values', function () {
Expand All @@ -12,6 +13,26 @@ describe('Create Logger', function () {
assume(logger.exitOnError).equals(true);
});

it('new Logger({ silent: true })', function (done) {
const neverLogTo = new TransportStream({
log: function (info) {
assume(false).true('TransportStream was improperly written to');
}
});

var logger = winston.createLogger({
transports: [neverLogTo],
silent: true
});

logger.log({
level: 'info',
message: 'This should be ignored'
});

setImmediate(() => done());
});

it('new Logger({ parameters })', function () {
let myFormat = format(function (info, opts) {
return info;
Expand Down
Loading

0 comments on commit 23d9036

Please sign in to comment.