3 } from 'helpers/Result';
5 describe('parseTime', () => {
6 test('null on empty', () => {
7 expect(parseTime()).toBeNull();
9 test('just numbers', () => {
10 expect(parseTime('1')).toEqual(1);
11 expect(parseTime('15')).toEqual(15);
12 expect(parseTime('60')).toEqual(60);
13 expect(parseTime('62')).toEqual(62);
14 expect(parseTime('500')).toEqual(500);
16 test('regular formats', () => {
17 expect(parseTime('1:00')).toEqual(60);
18 expect(parseTime('1:30')).toEqual(90);
19 expect(parseTime('0:70')).toEqual(70);
20 expect(parseTime('1:70')).toEqual(130);
21 expect(parseTime('01:20')).toEqual(80);
22 expect(parseTime('1:00:00')).toEqual(3600);
23 expect(parseTime('1:00:01')).toEqual(3601);
25 test('spaces', () => {
26 expect(parseTime(' 1:00')).toEqual(60);
27 expect(parseTime('1:00 ')).toEqual(60);
28 expect(parseTime('1 00')).toEqual(60);