0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-12-23 22:27:34 -05:00
verdaccio/packages/logger/logger-prettify/test/utils.test.ts
Juan Picado 631abe1ac1
refactor logger module (#3592)
* refactor logger module

* Update index.ts
2023-02-05 21:00:32 +01:00

20 lines
595 B
TypeScript

import { formatLoggingDate, padLeft, padRight } from '../src/utils';
describe('formatLoggingDate', () => {
test('basic', () => {
expect(formatLoggingDate(1585411248203, ' message')).toEqual('[2020-03-28 16:00:48] message');
});
});
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 ');
});
test('pad left', () => {
expect(padLeft('message left')).toEqual(' message left');
});
});