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

describe('UnpublishLeagueSeasonSchedulePresenter', () => {
  it('presents unpublish result with success and published=false', () => {
    const presenter = new UnpublishLeagueSeasonSchedulePresenter();

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

    const vm = presenter.getResponseModel();

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

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

    const vm = presenter.getResponseModel();

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

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

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

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

    presenter.reset();

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

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

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

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

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

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