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

describe('CreateLeagueSeasonScheduleRacePresenter', () => {
  it('presents create result with raceId', () => {
    const presenter = new CreateLeagueSeasonScheduleRacePresenter();

    presenter.present({
      raceId: 'race-123',
    });

    const vm = presenter.getResponseModel();

    expect(vm).not.toBeNull();
    expect(vm!.raceId).toBe('race-123');
  });

  it('returns null before present is called', () => {
    const presenter = new CreateLeagueSeasonScheduleRacePresenter();

    const vm = presenter.getResponseModel();

    expect(vm).toBeNull();
  });

  it('can be reset after presenting', () => {
    const presenter = new CreateLeagueSeasonScheduleRacePresenter();

    presenter.present({
      raceId: 'race-123',
    });

    expect(presenter.getResponseModel()).not.toBeNull();

    presenter.reset();

    expect(presenter.getResponseModel()).toBeNull();
  });

  it('can present multiple times with different race IDs', () => {
    const presenter = new CreateLeagueSeasonScheduleRacePresenter();

    // First presentation
    presenter.present({
      raceId: 'race-123',
    });

    let vm = presenter.getResponseModel();
    expect(vm!.raceId).toBe('race-123');

    // Second presentation (simulating reuse)
    presenter.present({
      raceId: 'race-456',
    });

    vm = presenter.getResponseModel();
    expect(vm!.raceId).toBe('race-456');
  });

  it('handles raceId with special characters', () => {
    const presenter = new CreateLeagueSeasonScheduleRacePresenter();

    presenter.present({
      raceId: 'race-abc-123_xyz',
    });

    const vm = presenter.getResponseModel();

    expect(vm).not.toBeNull();
    expect(vm!.raceId).toBe('race-abc-123_xyz');
  });
});