Skip to content

Commit 5494de2

Browse files
authored
test(time): verify behavior for invalid timezone identifiers (JhaSourav07#3085)
## Description Fixes JhaSourav07#2143 Added test coverage for invalid timezone identifiers in `getSecondsUntilMidnightInTimezone`. ## Pillar - [x] Pillar 3 — Timezone Logic Optimization ## Checklist - [x] I have read the CONTRIBUTING.md file. - [x] I have run npm run format. - [x] I have run npm run lint. - [x] I have run npm run typecheck. - [x] I have run npm run test. - [x] I have only one commit in this PR. ## Visual Preview N/A (test-only change) ## Changes Made - Added test for invalid timezone identifiers - Verified RangeError is thrown for unsupported timezone values - Documented current formatter behavior without modifying implementation ## Result - Improves test coverage for timezone validation edge cases - Prevents regressions in timezone handling behavior - Existing tests continue to pass
2 parents 4e9d699 + dc24136 commit 5494de2

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

utils/time.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,4 +350,10 @@ describe('getSecondsUntilMidnightInTimezone — extreme timezone offset boundary
350350

351351
expect(getSecondsUntilMidnightInTimezone('Pacific/Midway')).toBe(86400);
352352
});
353+
354+
it('throws a RangeError for invalid timezone identifiers', () => {
355+
vi.setSystemTime(new Date('2024-06-15T12:00:00.000Z'));
356+
357+
expect(() => getSecondsUntilMidnightInTimezone('Invalid/Timezone')).toThrow(RangeError);
358+
});
353359
});

0 commit comments

Comments
 (0)