Skip to content

Commit

Permalink
Fix logging system jest tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeelmers committed Feb 24, 2021
1 parent aa5d21e commit fb23cb1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 11 additions & 4 deletions src/core/server/logging/logging_system.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,15 @@ test('attaches appenders to appenders that declare refs', async () => {
await system.upgrade(
config.schema.validate({
appenders: {
console: { type: 'console', layout: { type: 'pattern' } },
file: { type: 'file', layout: { type: 'pattern' }, fileName: 'path' },
console: {
type: 'console',
layout: { type: 'pattern', pattern: '[%logger] %message %meta' },
},
file: {
type: 'file',
layout: { type: 'pattern', pattern: '[%logger] %message %meta' },
fileName: 'path',
},
rewrite: {
type: 'rewrite',
appenders: ['console', 'file'],
Expand All @@ -155,12 +162,12 @@ test('attaches appenders to appenders that declare refs', async () => {

expect(mockConsoleLog).toHaveBeenCalledTimes(1);
expect(mockConsoleLog.mock.calls[0][0]).toMatchInlineSnapshot(
`"[2012-01-30T22:33:22.011-05:00][WARN ][tests]{\\"a\\":\\"hi\\"} This message goes to a test context."`
`"[tests] This message goes to a test context. {\\"a\\":\\"hi\\"}"`
);

expect(mockStreamWrite).toHaveBeenCalledTimes(1);
expect(mockStreamWrite.mock.calls[0][0]).toMatchInlineSnapshot(`
"[2012-01-30T17:33:22.011-05:00][WARN ][tests]{\\"a\\":\\"hi\\"} This message goes to a test context.
"[tests] This message goes to a test context. {\\"a\\":\\"hi\\"}
"
`);
});
Expand Down

0 comments on commit fb23cb1

Please sign in to comment.