mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-15 12:23:51 +00:00
de9a7a87fd
* refactor(project structure): UI * refactor(project structure): extract utilities * refactor(project structure): remove unused * refactor(project structure): electron * refactor(project structure): server refactor: migrate to vitest refactor: monorepo config * refactor: extract application menu * refactor: exit process * refactor: extract tray menu * chore: electron build * Added Seconds in studio clock #282 --------- Co-authored-by: Fabian Posenau <fabian@fphome.de> --------- Co-authored-by: Fabian Posenau <fabian.p99@gmx.de> Co-authored-by: Fabian Posenau <fabian@fphome.de>
30 lines
744 B
JavaScript
30 lines
744 B
JavaScript
import { formatTime } from '../time';
|
|
|
|
describe('formatTime()', () => {
|
|
it('parses 24h strings', () => {
|
|
const ms = 13 * 60 * 60 * 1000;
|
|
const options = {
|
|
showSeconds: true,
|
|
format: 'irrelevant',
|
|
};
|
|
const time = formatTime(ms, options, () => '24');
|
|
expect(time).toStrictEqual('13:00:00');
|
|
});
|
|
|
|
it('parses same string in 12h strings', () => {
|
|
const ms = 13 * 60 * 60 * 1000;
|
|
const options = {
|
|
showSeconds: true,
|
|
format: 'hh:mm:ss a',
|
|
};
|
|
const time = formatTime(ms, options, () => '12');
|
|
expect(time).toStrictEqual('01:00:00 PM');
|
|
});
|
|
|
|
it('handles null times', () => {
|
|
const ms = null;
|
|
const time = formatTime(ms);
|
|
expect(time).toStrictEqual('...');
|
|
});
|
|
});
|