The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/apps/meteor/tests/unit/lib/utils/secondsToHHMMSS.spec.ts

28 lines
771 B

import { expect } from 'chai';
import { secondsToHHMMSS } from '../../../../lib/utils/secondsToHHMMSS';
describe('secondsToHHMMSS', () => {
const testCases = [
[0, '00:00:00'],
[1, '00:00:01'],
[60, '00:01:00'],
[61, '00:01:01'],
[3600, '01:00:00'],
[3601, '01:00:01'],
[3661, '01:01:01'],
[3661.1, '01:01:01'],
[3661.9, '01:01:02'], // rounding down?
[3662, '01:01:02'],
[86400, '24:00:00'],
[172800, '48:00:00'],
[360000, '100:00:00'], // should exceed 8 characters?
] as const;
testCases.forEach(([parameter, expectedResult]) => {
it(`should return ${JSON.stringify(expectedResult)} for ${JSON.stringify(parameter)}`, () => {
const result = secondsToHHMMSS(parameter);
expect(result).to.be.equal(expectedResult);
});
});
});