Skip to content

Commit 8e0b402

Browse files
Vivek TrivediVivek Trivedi
authored andcommitted
test(calculate): verify streak formulas for different starting days
1 parent 972e986 commit 8e0b402

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

lib/calculate.test.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,3 +386,28 @@ describe('calculateStreak — empty and sparse year edge cases', () => {
386386
expect(result.totalContributions).toBe(2);
387387
});
388388
});
389+
it('handles different week start days correctly', () => {
390+
// Simulating 2 full weeks (Sunday start vs Monday start shouldn't break logic)
391+
const calendar = buildCalendar([
392+
1,
393+
1,
394+
1,
395+
1,
396+
1,
397+
1,
398+
1, // week 1
399+
1,
400+
1,
401+
1,
402+
1,
403+
1,
404+
1,
405+
1, // week 2
406+
]);
407+
408+
const result = calculateStreak(calendar);
409+
410+
expect(result.currentStreak).toBe(14);
411+
expect(result.longestStreak).toBe(14);
412+
expect(result.totalContributions).toBe(14);
413+
});

0 commit comments

Comments
 (0)