Skip to content

Commit 08300d8

Browse files
authored
test(calculate): verify streak formulas for only weekend contribution… (JhaSourav07#1755)
…s timeline ## Description Fixes JhaSourav07#1494 ## Pillar - [ ] 🎨 Pillar 1 — New Theme Design - [ ] 📐 Pillar 2 — Geometric SVG Improvement - [ ] 🕐 Pillar 3 — Timezone Logic Optimization - [ ] 🛠️ Other (Bug fix, refactoring, docs) ## Visual Preview ## Checklist before requesting a review: - [x] I have read the `CONTRIBUTING.md` file. - [ ] 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. - [ ] 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.
2 parents 56fbc35 + 3898f54 commit 08300d8

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

lib/calculate.test.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,15 @@ describe('calculateStreak', () => {
4848
]);
4949

5050
const result = calculateStreak(calendar);
51-
5251
expect(result.currentStreak).toBe(0);
5352
expect(result.longestStreak).toBe(0);
5453
expect(result.totalContributions).toBe(0);
5554
});
55+
it('verifies weekend only streaks', () => {
56+
const c = buildCalendar([1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1]);
57+
const s = calculateStreak(c);
58+
expect(s.longestStreak).toBe(2);
59+
});
5660

5761
it('handles multiple weeks of zero contributions separating active streaks', () => {
5862
const calendar = buildCalendar([

0 commit comments

Comments
 (0)