Skip to content

Commit db27c9f

Browse files
test: add edge-case test for isolated single-day streak
1 parent e3369ea commit db27c9f

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

lib/calculate.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -989,18 +989,19 @@ describe('calculateStreak', () => {
989989
0,
990990
0,
991991
0, // Week 1: Empty week
992-
1, // 1 day of commits
992+
1, // Day 8: 1 isolated day of commits
993993
0,
994994
0,
995995
0,
996996
0,
997997
0,
998998
0,
999-
0, // Week 2: Empty week
999+
0, // Following 7 days: Empty week gap
10001000
]);
10011001

10021002
const result = calculateStreak(calendar);
10031003

1004+
// Assertions ensuring calculations handle index transitions gracefully
10041005
expect(result.currentStreak).toBe(0);
10051006
expect(result.longestStreak).toBe(1);
10061007
expect(result.totalContributions).toBe(1);

0 commit comments

Comments
 (0)