blob: 15e056e45d0848b4ef47075ec21bea3d8e62876f (
plain)
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
|
import { formatTimeSpent } from '~/lib/utils/datetime/time_spent_utility';
describe('Time spent utils', () => {
describe('formatTimeSpent', () => {
describe('with limitToHours false', () => {
it('formats 34500 seconds to `1d 1h 35m`', () => {
expect(formatTimeSpent(34500)).toEqual('1d 1h 35m');
});
it('formats -34500 seconds to `- 1d 1h 35m`', () => {
expect(formatTimeSpent(-34500)).toEqual('- 1d 1h 35m');
});
});
describe('with limitToHours true', () => {
it('formats 34500 seconds to `9h 35m`', () => {
expect(formatTimeSpent(34500, true)).toEqual('9h 35m');
});
it('formats -34500 seconds to `- 9h 35m`', () => {
expect(formatTimeSpent(-34500, true)).toEqual('- 9h 35m');
});
});
});
});
|