You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-07-16 00:14:34 +02:00
All: Improves formatting of log statements
This commit is contained in:
@ -57,6 +57,22 @@ describe('Logger', () => {
|
||||
jest.useRealTimers();
|
||||
});
|
||||
|
||||
test.each([
|
||||
[['one', 'two'], 'one two'],
|
||||
[[true, false, undefined, null], '<true> <false> <undefined> <null>'],
|
||||
[['123', 123], '123 123'],
|
||||
[[['a', 'b', ['sub1', 'sub2']]], '[a, b, [sub1, sub2]]'],
|
||||
[[''], ''],
|
||||
[[{ 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'));
|
||||
const logger = createLogger();
|
||||
logger.info(...input);
|
||||
await logger.waitForFileWritesToComplete_();
|
||||
expect(await getLogContent()).toBe(`2020-01-01 00:00:00: testing: ${expected}\n`);
|
||||
jest.useRealTimers();
|
||||
});
|
||||
|
||||
// it('should keep the last lines', async () => {
|
||||
// jest.useFakeTimers().setSystemTime(new Date('2020-01-01'));
|
||||
|
||||
|
Reference in New Issue
Block a user