import { describe, it, expect } from 'vitest';
import { LeagueScheduleViewModel } from './LeagueScheduleViewModel';

describe('LeagueScheduleViewModel', () => {
  it('exposes raceCount/hasRaces based on provided races', () => {
    const vm = new LeagueScheduleViewModel([
      {
        id: 'race-1',
        name: 'Round 1',
        scheduledAt: new Date('2025-01-02T20:00:00Z'),
        isPast: false,
        isUpcoming: true,
        status: 'scheduled',
      },
      {
        id: 'race-2',
        name: 'Round 2',
        scheduledAt: new Date('2024-12-31T20:00:00Z'),
        isPast: true,
        isUpcoming: false,
        status: 'completed',
      },
    ]);

    expect(vm.raceCount).toBe(2);
    expect(vm.hasRaces).toBe(true);
    expect(vm.races).toHaveLength(2);
  });

  it('handles empty schedules', () => {
    const vm = new LeagueScheduleViewModel([]);

    expect(vm.raceCount).toBe(0);
    expect(vm.hasRaces).toBe(false);
    expect(vm.races).toEqual([]);
  });
});
