Skip to content

Commit e97f565

Browse files
authored
test: add timezone boundary alignment coverage (JhaSourav07#3247)
## Description Fixes JhaSourav07#2800 ## Pillar - [x] 🎨 Pillar 1 β€” New Theme Design - [x] πŸ“ Pillar 2 β€” Geometric SVG Improvement - [x] πŸ• Pillar 3 β€” Timezone Logic Optimization - [x] πŸ› οΈ Other (Bug fix, refactoring, docs) ## Visual Preview ## Checklist before requesting a review: - [x] I have read the `CONTRIBUTING.md` file. - [x] I have tested these changes locally (`localhost:3000/api/streak?user=YOUR_USERNAME`). - [x] I have run `npm run format` and `npm run lint` locally and resolved all errors (CI will fail otherwise). - [x] My commits follow the Conventional Commits format (e.g., `feat(themes): ...`, `fix(calculate): ...`). - [x] I have updated `README.md` if I added a new theme or URL parameter. - [x] I have started the repo. - [x] I have made sure that i have only one commit to merge in this PR. - [x] The SVG output matches the CommitPulse "premium quality" aesthetic standard (no raw elements, smooth animations, correct fonts). - [x] I joined the CommitPulse Discord community for contributor discussions, mentorship, and faster PR support.
2 parents fea84c5 + cb1d530 commit e97f565

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

β€Žlib/calculate.test.tsβ€Ž

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1320,6 +1320,30 @@ describe('calculateStreak β€” timezone awareness', () => {
13201320
const result = calculateStreak(tzCalendar, 'UTC', nowUTC);
13211321
expect(result.todayDate).toBe('2024-06-16');
13221322
});
1323+
1324+
it('handles timezone boundary alignment between UTC, IST and JST', () => {
1325+
const calendar = {
1326+
totalContributions: 2,
1327+
weeks: [
1328+
{
1329+
contributionDays: [
1330+
{ contributionCount: 1, date: '2024-06-14' },
1331+
{ contributionCount: 1, date: '2024-06-15' },
1332+
],
1333+
},
1334+
],
1335+
};
1336+
1337+
const now = new Date('2024-06-14T20:00:00Z');
1338+
1339+
const utcResult = calculateStreak(calendar, 'UTC', now);
1340+
const istResult = calculateStreak(calendar, 'Asia/Kolkata', now);
1341+
const jstResult = calculateStreak(calendar, 'Asia/Tokyo', now);
1342+
1343+
expect(utcResult.todayDate).toBe('2024-06-14');
1344+
expect(istResult.todayDate).toBe('2024-06-15');
1345+
expect(jstResult.todayDate).toBe('2024-06-15');
1346+
});
13231347
});
13241348

13251349
describe('isStreakAlive', () => {

0 commit comments

Comments
Β (0)