forked from AIObjectives/talk-to-the-city-reports
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutils.test.ts
28 lines (27 loc) · 1.02 KB
/
utils.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import { secondsToHHMMSS, HHMMSSToSeconds } from '$lib/utils';
import { describe, it } from 'vitest';
import { expect } from 'vitest';
describe('Utils tests', () => {
it('Test secondsToHHMMSS', async () => {
expect(secondsToHHMMSS(0)).toEqual('00:00:00');
expect(secondsToHHMMSS(1)).toEqual('00:00:01');
expect(secondsToHHMMSS(60)).toEqual('00:01:00');
expect(secondsToHHMMSS(3600)).toEqual('01:00:00');
});
it('Test secondsToHHMMSS with string', async () => {
// @ts-ignore
expect(secondsToHHMMSS('0')).toEqual('00:00:00');
// @ts-ignore
expect(secondsToHHMMSS('1')).toEqual('00:00:01');
// @ts-ignore
expect(secondsToHHMMSS('60')).toEqual('00:01:00');
// @ts-ignore
expect(secondsToHHMMSS('3600')).toEqual('01:00:00');
});
it('Test HHMMSSToSeconds', async () => {
expect(HHMMSSToSeconds('00:00:00')).toEqual(0);
expect(HHMMSSToSeconds('00:00:01')).toEqual(1);
expect(HHMMSSToSeconds('00:01:00')).toEqual(60);
expect(HHMMSSToSeconds('01:00:00')).toEqual(3600);
});
});