Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit 992be8a

Browse files
author
Michal Vlasák
committed
Add child test
1 parent cac34af commit 992be8a

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

src/tests/index.test.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,29 @@ test('can use warning level', () => {
6363
expect(loggerWrites).toBeCalled();
6464
});
6565

66+
test('child logger has warning level', () => {
67+
const loggerWrites = jest.fn();
68+
loggerFactory({
69+
streams: [
70+
{
71+
stream: new Writable({
72+
write: (chunk, encoding, next) => {
73+
const json = JSON.parse(chunk);
74+
expect(json.message).toBe('Hello');
75+
expect(json.level).toBe(levels.warn);
76+
loggerWrites();
77+
next();
78+
},
79+
}),
80+
},
81+
],
82+
});
83+
const childLogger = loggerFactory('child');
84+
85+
childLogger.warning('Hello');
86+
expect(loggerWrites).toBeCalled();
87+
});
88+
6689
test('express binds', () => {
6790
const logger = loggerFactory();
6891
const app = express();

0 commit comments

Comments
 (0)