utils.spec.tsx 878 B

1234567891011121314151617181920212223242526
  1. import {getChunkTimeRange} from './utils';
  2. describe('getChunkTimeRange', () => {
  3. const start = 1000000000; // Easier to understand timestamp
  4. const chunkDurationMs = 500000; // Half a minute
  5. it('should return correct timestamps for the first chunk', () => {
  6. const chunkIndex = 0;
  7. expect(getChunkTimeRange(start, chunkIndex, chunkDurationMs)).toEqual([
  8. 1000000000, 1000500001,
  9. ]);
  10. });
  11. it('should return correct timestamps for a chunk in the middle', () => {
  12. const chunkIndex = 2;
  13. expect(getChunkTimeRange(start, chunkIndex, chunkDurationMs)).toEqual([
  14. 1001000000, 1001500001,
  15. ]);
  16. });
  17. it('should return correct timestamps for the last chunk', () => {
  18. const chunkIndex = 10; // Assume 10 chunks total
  19. expect(getChunkTimeRange(start, chunkIndex, chunkDurationMs)).toEqual([
  20. 1005000000, 1005500001,
  21. ]);
  22. });
  23. });