|
3 | 3 | sum, |
4 | 4 | chunkIntoWeeks, |
5 | 5 | buildWeeklyEvolutionFromDaily, |
6 | | - addDays, |
7 | 6 | clamp, |
8 | 7 | quantile, |
9 | 8 | winsorize, |
@@ -325,59 +324,6 @@ describe('buildWeeklyEvolutionFromDaily', () => { |
325 | 324 | }) |
326 | 325 | }) |
327 | 326 |
|
328 | | -describe('addDays', () => { |
329 | | - it('returns a new Date instance (does not mutate original)', () => { |
330 | | - const original = new Date('2028-01-01T00:00:00Z') |
331 | | - const result = addDays(original, 5) |
332 | | - |
333 | | - expect(result).not.toBe(original) |
334 | | - expect(original.toISOString()).toBe('2028-01-01T00:00:00.000Z') |
335 | | - }) |
336 | | - |
337 | | - it('adds positive days correctly', () => { |
338 | | - const date = new Date('2028-01-01T00:00:00Z') |
339 | | - const result = addDays(date, 10) |
340 | | - |
341 | | - expect(result.toISOString()).toBe('2028-01-11T00:00:00.000Z') |
342 | | - }) |
343 | | - |
344 | | - it('subtracts days when negative value is provided', () => { |
345 | | - const date = new Date('2028-01-10T00:00:00Z') |
346 | | - const result = addDays(date, -5) |
347 | | - |
348 | | - expect(result.toISOString()).toBe('2028-01-05T00:00:00.000Z') |
349 | | - }) |
350 | | - |
351 | | - it('handles month overflow correctly', () => { |
352 | | - const date = new Date('2028-01-28T00:00:00Z') |
353 | | - const result = addDays(date, 5) |
354 | | - |
355 | | - expect(result.toISOString()).toBe('2028-02-02T00:00:00.000Z') |
356 | | - }) |
357 | | - |
358 | | - it('handles year overflow correctly', () => { |
359 | | - const date = new Date('2027-12-29T00:00:00Z') |
360 | | - const result = addDays(date, 5) |
361 | | - |
362 | | - expect(result.toISOString()).toBe('2028-01-03T00:00:00.000Z') |
363 | | - }) |
364 | | - |
365 | | - it('handles leap year correctly', () => { |
366 | | - const date = new Date('2028-02-27T00:00:00Z') // 2028 is leap year |
367 | | - const result = addDays(date, 2) |
368 | | - |
369 | | - expect(result.toISOString()).toBe('2028-02-29T00:00:00.000Z') |
370 | | - }) |
371 | | - |
372 | | - it('keeps UTC behavior consistent (no timezone drift)', () => { |
373 | | - const date = new Date('2028-03-01T00:00:00Z') |
374 | | - const result = addDays(date, 1) |
375 | | - |
376 | | - expect(result.getUTCHours()).toBe(0) |
377 | | - expect(result.toISOString()).toBe('2028-03-02T00:00:00.000Z') |
378 | | - }) |
379 | | -}) |
380 | | - |
381 | 327 | describe('clamp', () => { |
382 | 328 | it('returns the value when it is within bounds', () => { |
383 | 329 | expect(clamp(5, 0, 10)).toBe(5) |
|
0 commit comments