2017-11-06 08:32:12 -05:00
|
|
|
import { pad, pikadayToString } from '~/lib/utils/datefix';
|
2017-10-18 07:31:01 -04:00
|
|
|
|
|
|
|
describe('datefix', () => {
|
|
|
|
describe('pad', () => {
|
|
|
|
it('should add a 0 when length is smaller than 2', () => {
|
|
|
|
expect(pad(2)).toEqual('02');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should not add a zero when lenght matches the default', () => {
|
|
|
|
expect(pad(12)).toEqual('12');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should add a 0 when lenght is smaller than the provided', () => {
|
|
|
|
expect(pad(12, 3)).toEqual('012');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('parsePikadayDate', () => {
|
2017-11-06 08:32:12 -05:00
|
|
|
// removed because of https://gitlab.com/gitlab-org/gitlab-ce/issues/39834
|
2017-10-18 07:31:01 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
describe('pikadayToString', () => {
|
|
|
|
it('should format a UTC date into yyyy-mm-dd format', () => {
|
2017-12-05 17:40:42 -05:00
|
|
|
expect(pikadayToString(new Date('2020-01-29:00:00'))).toEqual('2020-01-29');
|
2017-10-18 07:31:01 -04:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|