Commit 83e2fed
authored
test(calculate): verify calculateMonthlyStats handles empty calendar gracefully JhaSourav07#1052 (JhaSourav07#1167)
## Description
Added a new edge-case test in lib/calculate.test.ts for the
calculateMonthlyStats function. The test constructs an explicitly empty
calendar ({ totalContributions: 0, weeks: [] }) and verifies that the
function does not throw an error during execution. It also asserts that
both currentMonthTotal and previousMonthTotal safely return 0.
Fixes JhaSourav07#1052
## Pillar
- [ ] 🎨 Pillar 1 — New Theme Design
- [ ] 📐 Pillar 2 — Geometric SVG Improvement
- [ ] 🕐 Pillar 3 — Timezone Logic Optimization
- [x] 🛠️ Other (Bug fix, refactoring, docs)
## Visual Preview
<img width="929" height="386" alt="Screenshot 2026-05-29 104429"
src="https://github.com/user-attachments/assets/cd025746-06b3-4853-a37b-df373b85cf6b"
/>
## 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 starred 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.
[x] (Recommended) I joined the CommitPulse Discord community for
contributor discussions.1 file changed
Lines changed: 23 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
443 | 443 | | |
444 | 444 | | |
445 | 445 | | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
446 | 469 | | |
447 | 470 | | |
448 | 471 | | |
| |||
0 commit comments