Skip to content

Commit 1327559

Browse files
committed
BC-11368 - Refactor logger tests for consistency and clarity
1 parent a6fd08a commit 1327559

File tree

1 file changed

+4
-15
lines changed

1 file changed

+4
-15
lines changed

src/infra/logger/logger.spec.ts

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,19 @@ describe('Logger', () => {
99
let logger: Logger;
1010
let processStdoutWriteSpy: jest.SpyInstance<
1111
boolean,
12-
[str: string | Uint8Array, encoding?: BufferEncoding | undefined, cb?: ((err?: Error) => void) | undefined],
12+
[str: string | Uint8Array, encoding?: BufferEncoding | undefined, cb?: ((err?: Error | null) => void) | undefined],
1313
unknown
1414
>;
1515
let processStderrWriteSpy: jest.SpyInstance<
1616
boolean,
17-
[str: string | Uint8Array, encoding?: BufferEncoding | undefined, cb?: ((err?: Error) => void) | undefined],
17+
[str: string | Uint8Array, encoding?: BufferEncoding | undefined, cb?: ((err?: Error | null) => void) | undefined],
1818
unknown
1919
>;
2020
let winstonLogger: DeepMocked<WinstonLogger>;
2121

2222
beforeAll(async () => {
2323
const module: TestingModule = await Test.createTestingModule({
24-
providers: [
25-
Logger,
26-
{
27-
provide: WINSTON_MODULE_PROVIDER,
28-
useValue: createMock<WinstonLogger>(),
29-
},
30-
],
24+
providers: [Logger, { provide: WINSTON_MODULE_PROVIDER, useValue: createMock<WinstonLogger>() }],
3125
}).compile();
3226

3327
logger = await module.resolve(Logger);
@@ -73,12 +67,7 @@ describe('Logger', () => {
7367
const error = new Error('custom error');
7468
const message: RequestLoggingBody = {
7569
userId: '123',
76-
request: {
77-
url: 'http://localhost',
78-
method: 'GET',
79-
params: { id: '1' },
80-
query: { page: '1' },
81-
},
70+
request: { url: 'http://localhost', method: 'GET', params: { id: '1' }, query: { page: '1' } },
8271
error,
8372
};
8473
logger.http(message, error.stack);

0 commit comments

Comments
 (0)