Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mshustov committed Jan 31, 2020
1 parent 7f51269 commit e6bbae4
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.

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

12 changes: 10 additions & 2 deletions src/core/server/logging/logging_config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,23 @@ test('`getLoggerContext()` returns correct joined context name.', () => {
expect(LoggingConfig.getLoggerContext([])).toEqual('root');
});

test('correctly fills in default `appenders` config.', () => {
test('correctly fills in default config.', () => {
const configValue = new LoggingConfig(config.schema.validate({}));

expect(configValue.appenders.size).toBe(1);
expect(configValue.appenders.size).toBe(3);

expect(configValue.appenders.get('default')).toEqual({
kind: 'console',
layout: { kind: 'pattern', highlight: true },
});
expect(configValue.appenders.get('console')).toEqual({
kind: 'console',
layout: { kind: 'pattern', highlight: true },
});
expect(configValue.appenders.get('file')).toEqual({
kind: 'file',
layout: { kind: 'pattern', highlight: false },
});
});

test('correctly fills in custom `appenders` config.', () => {
Expand Down
7 changes: 7 additions & 0 deletions src/core/server/logging/logging_config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,13 @@ export class LoggingConfig {
* Map of the appender unique arbitrary key and its corresponding config.
*/
public readonly appenders: Map<string, AppenderConfigType> = new Map([
[
'default',
{
kind: 'console',
layout: { kind: 'pattern', highlight: true },
} as AppenderConfigType,
],
[
'console',
{
Expand Down

0 comments on commit e6bbae4

Please sign in to comment.