1
0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2025-01-10 13:56:47 +01:00
immich/web/src/lib/utils/time-to-seconds.spec.ts
Jason Rasmussen f55b3add80
chore(web): prettier (#2821)
Co-authored-by: Thomas Way <thomas@6f.io>
2023-06-30 23:50:47 -05:00

24 lines
759 B
TypeScript

import { describe, expect, it } from '@jest/globals';
import { timeToSeconds } from './time-to-seconds';
describe('converting time to seconds', () => {
it('parses hh:mm:ss correctly', () => {
expect(timeToSeconds('01:02:03')).toBeCloseTo(3723);
});
it('parses hh:mm:ss.SSS correctly', () => {
expect(timeToSeconds('01:02:03.456')).toBeCloseTo(3723.456);
});
it('parses h:m:s.S correctly', () => {
expect(timeToSeconds('1:2:3.4')).toBeCloseTo(3723.4);
});
it('parses hhh:mm:ss.SSS correctly', () => {
expect(timeToSeconds('100:02:03.456')).toBeCloseTo(360123.456);
});
it('ignores ignores double milliseconds hh:mm:ss.SSS.SSSSSS', () => {
expect(timeToSeconds('01:02:03.456.123456')).toBeCloseTo(3723.456);
});
});