Commit 8080eff
authored
test(calculate): verify streak formulas for timezone shifts around midnight timeline (JhaSourav07#1854)
## Description
Fixes JhaSourav07#1500
Added a new test case in `lib/calculate.test.ts` to verify streak
calculations when contribution activity occurs around midnight across
different timezone offsets.
The test simulates a scenario where the same UTC timestamp maps to
different local dates depending on the configured timezone and verifies
that:
* `todayDate` is calculated correctly for each timezone.
* Active streaks remain accurate across date boundaries.
* Grace-period behavior works correctly when local midnight causes a day
shift.
* Longest streak calculations remain unaffected by timezone changes.
## Pillar
* [ ] 🎨 Pillar 1 — New Theme Design
* [ ] 📐 Pillar 2 — Geometric SVG Improvement
* [x] 🕐 Pillar 3 — Timezone Logic Optimization
* [ ] 🛠️ Other (Bug fix, refactoring, docs)
## Visual Preview
Not applicable — this PR only adds automated test coverage.
## 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): ...`).
* [ ] 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] (Recommended) I joined the CommitPulse Discord community for
contributor discussions, mentorship, and faster PR support.1 file changed
Lines changed: 29 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
383 | 383 | | |
384 | 384 | | |
385 | 385 | | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
386 | 415 | | |
387 | 416 | | |
388 | 417 | | |
| |||
0 commit comments