2024-08-03 22:52:48 +02:00
|
|
|
import { describe, expect, test } from 'vitest';
|
|
|
|
|
2024-06-01 12:35:06 -07:00
|
|
|
import { formatLoggingDate, padRight } from '../src/utils';
|
2022-08-18 21:39:34 +02:00
|
|
|
|
|
|
|
describe('formatLoggingDate', () => {
|
|
|
|
test('basic', () => {
|
2024-06-01 12:35:06 -07:00
|
|
|
expect(formatLoggingDate(1585411248203, 'message')).toEqual('[2020-03-28 16:00:48] message');
|
2022-08-18 21:39:34 +02:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('pad', () => {
|
|
|
|
test('pad right with custom length', () => {
|
|
|
|
expect(padRight('message right', 20)).toEqual('message right ');
|
|
|
|
});
|
|
|
|
|
|
|
|
test('pad right 2', () => {
|
|
|
|
expect(padRight('message right')).toEqual('message right ');
|
|
|
|
});
|
|
|
|
});
|