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

describe('RejectLeagueJoinRequestPresenter', () => {
  let presenter: RejectLeagueJoinRequestPresenter;

  beforeEach(() => {
    presenter = new RejectLeagueJoinRequestPresenter();
  });

  describe('present', () => {
    it('should present successful rejection result', () => {
      const result = {
        success: true,
        message: 'Join request rejected successfully',
      };

      presenter.present(result);

      const vm = presenter.getViewModel();

      expect(vm).toEqual({
        success: true,
        message: 'Join request rejected successfully',
      });
    });

    it('should present failed rejection result', () => {
      const result = {
        success: false,
        message: 'Failed to reject join request',
      };

      presenter.present(result);

      const vm = presenter.getViewModel();

      expect(vm).toEqual({
        success: false,
        message: 'Failed to reject join request',
      });
    });
  });

  describe('getViewModel', () => {
    it('should return null before presentation', () => {
      expect(presenter.getViewModel()).toBeNull();
    });

    it('should return the model after presentation', () => {
      presenter.present({ success: true, message: 'Test' });

      expect(presenter.getViewModel()).toEqual({
        success: true,
        message: 'Test',
      });
    });
  });

  describe('reset', () => {
    it('should reset the model to null', () => {
      presenter.present({ success: true, message: 'Test' });
      expect(presenter.getViewModel()).not.toBeNull();

      presenter.reset();

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