blob: 7e632d099fc25c553dd2d3f87fd11fc1d485327d (
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
26
|
import { formattedTime } from '~/pipelines/stores/test_reports/utils';
describe('Test reports utils', () => {
describe('formattedTime', () => {
describe('when time is smaller than a second', () => {
it('should return time in milliseconds fixed to 2 decimals', () => {
const result = formattedTime(0.4815162342);
expect(result).toBe('481.52ms');
});
});
describe('when time is equal to a second', () => {
it('should return time in seconds fixed to 2 decimals', () => {
const result = formattedTime(1);
expect(result).toBe('1.00s');
});
});
describe('when time is greater than a second', () => {
it('should return time in seconds fixed to 2 decimals', () => {
const result = formattedTime(4.815162342);
expect(result).toBe('4.82s');
});
});
});
});
|