gitshark

Clone repository

git clone https://git.vilip.de/git/vilip/taskflow.git
git clone git@git.vilip.de:vilip/taskflow.git
import { buildCalendarWeeks } from '../calendar';

describe('buildCalendarWeeks', () => {
  it('places each weekday in the correct column (June 2026 starts on Monday)', () => {
    // Month is 0-indexed: 5 = June. June 1 2026 is a Monday, June 6 is a Saturday.
    const weeks = buildCalendarWeeks(2026, 5);
    // Sunday column is empty, Saturday column holds the 6th — not skipped.
    expect(weeks[0]).toEqual([null, 1, 2, 3, 4, 5, 6]);
  });

  it('always returns full 7-column weeks', () => {
    const weeks = buildCalendarWeeks(2026, 5);
    weeks.forEach((week) => expect(week).toHaveLength(7));
  });

  it('starts in the first column when the month begins on a Sunday (Feb 2026)', () => {
    // Feb 1 2026 is a Sunday.
    const weeks = buildCalendarWeeks(2026, 1);
    expect(weeks[0][0]).toBe(1);
  });

  it('includes every day of the month exactly once and in order', () => {
    const weeks = buildCalendarWeeks(2026, 5);
    const days = weeks.flat().filter((d): d is number => d !== null);
    expect(days).toEqual(Array.from({ length: 30 }, (_, i) => i + 1));
  });
});

Keyboard shortcuts

?Show this help
g hGo home
EscClose dialog