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

describe('PublishLeagueSeasonSchedulePresenter', () => {
  it('presents publish result with success and published=true', () => {
    const presenter = new PublishLeagueSeasonSchedulePresenter();

    presenter.present({
      success: true,
      seasonId: 'season-1',
      published: true,
    });

    const vm = presenter.getResponseModel();

    expect(vm).not.toBeNull();
    expect(vm!.success).toBe(true);
    expect(vm!.published).toBe(true);
  });

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

    const vm = presenter.getResponseModel();

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

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

    presenter.present({
      success: true,
      seasonId: 'season-1',
      published: true,
    });

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

    presenter.reset();

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

  it('can present multiple times with different results', () => {
    const presenter = new PublishLeagueSeasonSchedulePresenter();

    // First presentation
    presenter.present({
      success: true,
      seasonId: 'season-1',
      published: true,
    });

    let vm = presenter.getResponseModel();
    expect(vm!.published).toBe(true);

    // Second presentation (simulating reuse)
    presenter.present({
      success: true,
      seasonId: 'season-2',
      published: true,
    });

    vm = presenter.getResponseModel();
    expect(vm!.published).toBe(true);
  });
});