Total Complexity | 1 |
Complexity/F | 1 |
Lines of Code | 34 |
Function Count | 1 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | import { assert } from 'chai'; |
||
2 | import { load } from '../../utils'; |
||
3 | |||
4 | const { formatTime } = load('utils/formatters.js'); |
||
5 | |||
6 | suite('formatTime'); |
||
7 | |||
8 | test('Positive: formatTime', async function () { |
||
9 | const day = 86_400_000; |
||
|
|||
10 | |||
11 | assert.equal( |
||
12 | formatTime(10 * 1000 + 5), |
||
13 | '10s 5ms' |
||
14 | ); |
||
15 | assert.equal( |
||
16 | formatTime(2 * 60 * 60 * 1000 + 5 * 1000, 3), |
||
17 | '2h 5s' |
||
18 | ); |
||
19 | |||
20 | assert.equal( |
||
21 | formatTime(1 * 60 * 60 * 1000 + 10 * 60 * 1000 + 5 * 1000, 3), |
||
22 | '1h 10min 5s' |
||
23 | ); |
||
24 | |||
25 | assert.equal( |
||
26 | formatTime(7 * day + 12, 3), |
||
27 | '7d' |
||
28 | ); |
||
29 | |||
30 | assert.equal( |
||
31 | formatTime(7 * day + 12, 4), |
||
32 | '7d 12ms' |
||
33 | ); |
||
34 | }); |
||
35 |
This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.
To learn more about declaring variables in Javascript, see the MDN.