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

describe('UpcomingRaceCardViewModel', () => {
  const baseDto = {
    id: 'race-1',
    track: 'Spa-Francorchamps',
    car: 'GT3',
    scheduledAt: '2025-01-01T20:00:00Z',
  };

  it('maps DTO fields', () => {
    const viewModel = new UpcomingRaceCardViewModel(baseDto);

    expect(viewModel.id).toBe('race-1');
    expect(viewModel.track).toBe('Spa-Francorchamps');
    expect(viewModel.car).toBe('GT3');
    expect(viewModel.scheduledAt).toBe('2025-01-01T20:00:00Z');
  });

  it('formats date label with month and day', () => {
    const viewModel = new UpcomingRaceCardViewModel(baseDto);

    const formatted = viewModel.formattedDate;

    expect(formatted).toMatch(/\d{1,2}/);
  });
});
