Spaces:
Running
Running
File size: 900 Bytes
b8cc2bf | 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 27 28 29 30 | import { describe, it, expect } from 'vitest';
import { formatDuration } from './time';
describe('formatDuration', () => {
it('should format 0 seconds as 00:00', () => {
expect(formatDuration(0)).toBe('00:00');
});
it('should format seconds less than a minute correctly', () => {
expect(formatDuration(30)).toBe('00:30');
expect(formatDuration(59)).toBe('00:59');
});
it('should format minutes correctly', () => {
expect(formatDuration(60)).toBe('01:00');
expect(formatDuration(65)).toBe('01:05');
expect(formatDuration(3599)).toBe('59:59');
});
it('should format hours correctly', () => {
expect(formatDuration(3600)).toBe('01:00:00');
expect(formatDuration(3665)).toBe('01:01:05');
expect(formatDuration(7200)).toBe('02:00:00');
});
it('should handle large durations', () => {
expect(formatDuration(36000)).toBe('10:00:00');
});
});
|