import { RejectLeagueJoinRequestUseCase } from '@core/racing/application/use-cases/RejectLeagueJoinRequestUseCase';
import { RejectLeagueJoinRequestPresenter } from '@apps/api/src/modules/league/presenters/RejectLeagueJoinRequestPresenter';


describe('RejectLeagueJoinRequestUseCase', () => {
  let useCase: RejectLeagueJoinRequestUseCase;
  let leagueMembershipRepository: jest.Mocked<ILeagueMembershipRepository>;
  let presenter: RejectLeagueJoinRequestPresenter;

  beforeEach(() => {
    leagueMembershipRepository = {
      removeJoinRequest: jest.fn(),
    } as unknown;
    presenter = new RejectLeagueJoinRequestPresenter();
    useCase = new RejectLeagueJoinRequestUseCase(leagueMembershipRepository);
  });

  it('should reject join request', async () => {
    const requestId = 'req-1';

    await useCase.execute({ requestId }, presenter);

    expect(leagueMembershipRepository.removeJoinRequest).toHaveBeenCalledWith(requestId);
    expect(presenter.viewModel).toEqual({ success: true, message: 'Join request rejected.' });
  });
});