All: Fix logger tests by adding time (#10433)

pull/10435/head
pedr 2024-05-15 11:37:31 -03:00 committed by GitHub
parent cd0ff94c0c
commit ccd181851c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 3 deletions

View File

@ -38,7 +38,7 @@ describe('Logger', () => {
});
it('should log to file', async () => {
jest.useFakeTimers().setSystemTime(new Date('2020-01-01'));
jest.useFakeTimers().setSystemTime(new Date('2020-01-01 00:00:00'));
const logger = createLogger();
logger.debug('one');
@ -65,7 +65,7 @@ describe('Logger', () => {
[[''], ''],
[[{ that: 'is json', sub: { key1: 'abc', key2: 'def' } }], '{"that":"is json","sub":{"key1":"abc","key2":"def"}}'],
])('should format messages correctly', async (input, expected) => {
jest.useFakeTimers().setSystemTime(new Date('2020-01-01'));
jest.useFakeTimers().setSystemTime(new Date('2020-01-01 00:00:00'));
const logger = createLogger();
logger.info(...input);
await logger.waitForFileWritesToComplete_();
@ -74,7 +74,7 @@ describe('Logger', () => {
});
// it('should keep the last lines', async () => {
// jest.useFakeTimers().setSystemTime(new Date('2020-01-01'));
// jest.useFakeTimers().setSystemTime(new Date('2020-01-01 00:00:00'));
// const logger = createLogger();
// logger.keptLineCount = 2;