Files
probot/test/logger.test.js
tcbyrd 30af8747c2 Refactor imports and exports and fix tests
Convert the rest of the files in `/src` and disable allowJs

Move everything to named exports

Update bin to use named exports

Make all tests js and use named exports
2018-02-25 20:42:25 -05:00

31 lines
738 B
JavaScript

const {logger} = require('../src/logger')
const {wrapLogger} = require('../src/wrap-logger')
describe('logger', () => {
let output
beforeEach(() => {
output = []
logger.addStream({
level: 'trace',
type: 'raw',
stream: {write: log => output.push(log)}
})
})
describe('child', () => {
test('sets attributes', () => {
const child = wrapLogger(logger).child({user: 'me'})
child.debug('attributes will get added to this')
expect(output[0]).toHaveProperty('user', 'me')
})
test('allows setting the name', () => {
const child = wrapLogger(logger).child({name: 'test'})
child.debug('hello')
expect(output[0]).toHaveProperty('name', 'test')
})
})
})