Skip to content

Commit 51834de

Browse files
committed
test(calculate): verify weekend ratio for weekday-only calendar
1 parent bcd0718 commit 51834de

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

lib/calculate.test.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,27 @@ describe('aggregateCalendars', () => {
490490
});
491491

492492
describe('calculateWrappedStats', () => {
493+
it('returns weekendRatio as 0 when all contributions occur on weekdays', () => {
494+
const calendar = {
495+
totalContributions: 25,
496+
weeks: [
497+
{
498+
contributionDays: [
499+
{ date: '2024-01-01', contributionCount: 5 }, // Mon
500+
{ date: '2024-01-02', contributionCount: 5 }, // Tue
501+
{ date: '2024-01-03', contributionCount: 5 }, // Wed
502+
{ date: '2024-01-04', contributionCount: 5 }, // Thu
503+
{ date: '2024-01-05', contributionCount: 5 }, // Fri
504+
],
505+
},
506+
],
507+
};
508+
509+
const result = calculateWrappedStats(calendar);
510+
511+
expect(result.weekendRatio).toBe(0);
512+
});
513+
493514
it('calculates GitHub Wrapped stats accurately', () => {
494515
// 2024-01-01 was a Monday. Indices 5 (Sat) and 6 (Sun) are the weekend.
495516
const cal = buildCalendar([0, 0, 0, 0, 0, 5, 15]);

0 commit comments

Comments
 (0)