We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3ed113d commit 07244fdCopy full SHA for 07244fd
1 file changed
lib/calculate.test.ts
@@ -679,6 +679,20 @@ describe('calculateStreak', () => {
679
expect(resultTuesday.longestStreak).toBe(2);
680
});
681
682
+ it('verify streak formulas for single day contribution timeline (Variation 1)', () => {
683
+ // 1 commit on day 11 (middle of week 2), surrounded by fully empty weeks on both sides
684
+ const calendar = buildCalendar([
685
+ 0, 0, 0, 0, 0, 0, 0, // Week 1: empty
686
+ 0, 0, 0, 1, 0, 0, 0, // Week 2: single commit on day 4
687
+ 0, 0, 0, 0, 0, 0, 0, // Week 3: empty
688
+ ]);
689
+ const result = calculateStreak(calendar);
690
+
691
+ expect(result.currentStreak).toBe(0);
692
+ expect(result.longestStreak).toBe(1);
693
+ expect(result.totalContributions).toBe(1);
694
+ });
695
696
it('verify streak formulas for different starting days of the week timeline (Variation 2)', () => {
697
// Week 1: 0, 0, 1, 1, 1, 1, 1 (Starts on Wednesday, 5 days)
698
// Week 2: 1, 1, 1, 1, 1, 1, 1 (7 days)
0 commit comments