Skip to content

Commit

Permalink
Merge pull request #55 from seegno/support/update-linting-rules
Browse files Browse the repository at this point in the history
Update linting rules
  • Loading branch information
ruimarinho committed Apr 10, 2016
2 parents 3314e2c + c72f577 commit 129ea08
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions test/index_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,54 +4,54 @@
*/

import Logger from 'bunyan';
import debugnyan from '../src/index';
import debug from 'debug';
import debugnyan from '../src/index';

describe('debugnyan', () => {
it('should return an instance of a bunyan logger', () => {
let logger = debugnyan('foo');
const logger = debugnyan('foo');

logger.should.be.an.instanceOf(Logger);
logger.fields.name.should.equal('foo');
});

it('should return the same logger instance', () => {
let logger1 = debugnyan('fuu');
let logger2 = debugnyan('fuu');
const logger1 = debugnyan('fuu');
const logger2 = debugnyan('fuu');

logger1.should.equal(logger2);
});

it('should have a default level above fatal (no output)', () => {
let logger = debugnyan('net');
const logger = debugnyan('net');

logger.level().should.equal(Logger.FATAL + 1);
});

it('should accept a dictionary of options', () => {
let logger = debugnyan('biz', { bar: 'qux', biz: 'net' });
const logger = debugnyan('biz', { bar: 'qux', biz: 'net' });

logger.fields.bar.should.equal('qux');
logger.fields.biz.should.equal('net');
});

it('should ignore the `name` option', () => {
let logger = debugnyan('nor', { name: 'bar' });
const logger = debugnyan('nor', { name: 'bar' });

logger.fields.name.should.equal('nor');
});

it('should be on the debug level if `DEBUG` matches logger name', () => {
debug.enable('abc');

let logger = debugnyan('abc');
const logger = debugnyan('abc');

logger.level().should.equal(Logger.DEBUG);
});

describe('namespacing', () => {
it('should support multiple components separated by colons', () => {
let logger = debugnyan('foo:bar:biz:qux');
const logger = debugnyan('foo:bar:biz:qux');

logger.should.be.an.instanceOf(Logger);
logger.fields.name.should.equal('foo');
Expand All @@ -61,31 +61,31 @@ describe('debugnyan', () => {
});

it('should ignore the component option', () => {
let logger = debugnyan('foo:bar', { component: 'biz' });
const logger = debugnyan('foo:bar', { component: 'biz' });

logger.fields.component.should.equal('bar');
});

it('should be on the debug level if `DEBUG` matches logger name', () => {
debug.enable('foo:bar');

let logger = debugnyan('foo:bar');
const logger = debugnyan('foo:bar');

logger.level().should.equal(Logger.DEBUG);
});

it('should return the same logger instances', () => {
let logger1 = debugnyan('foo:bar');
let logger2 = debugnyan('foo:bar');
const logger1 = debugnyan('foo:bar');
const logger2 = debugnyan('foo:bar');

logger1.should.equal(logger2);
});

it('should enable the debug level if parent is declared before children', () => {
debug.enable('zab:oof');

let logger1 = debugnyan('zab:oof');
let logger2 = debugnyan('zab:oof:zib');
const logger1 = debugnyan('zab:oof');
const logger2 = debugnyan('zab:oof:zib');

logger1.level().should.equal(Logger.DEBUG);
logger2.level().should.equal(Logger.DEBUG);
Expand All @@ -94,8 +94,8 @@ describe('debugnyan', () => {
it('should not enable the debug level if parent is declared after children', () => {
debug.enable('kao:oob');

let logger1 = debugnyan('kao:oob:zib');
let logger2 = debugnyan('kao:oob');
const logger1 = debugnyan('kao:oob:zib');
const logger2 = debugnyan('kao:oob');

logger1.level().should.not.equal(Logger.DEBUG);
logger2.level().should.equal(Logger.DEBUG);
Expand Down

0 comments on commit 129ea08

Please sign in to comment.