import type { GetLeagueJoinRequestsResult } from '@core/racing/application/use-cases/GetLeagueJoinRequestsUseCase';
import { LeagueJoinRequestsPresenter } from './LeagueJoinRequestsPresenter';

describe('LeagueJoinRequestsPresenter', () => {
  it('presents join requests correctly', () => {
    const presenter = new LeagueJoinRequestsPresenter();
    const output: GetLeagueJoinRequestsResult = {
      joinRequests: [
        {
          id: 'req-1',
          leagueId: 'league-1',
          driverId: 'driver-1',
          requestedAt: new Date('2023-01-01'),
          message: 'Please accept me',
          // eslint-disable-next-line @typescript-eslint/no-explicit-any
          driver: { id: 'driver-1', name: 'John Doe' } as never,
        },
      ],
    };

    presenter.present(output);
    const vm = presenter.getViewModel()!;

    expect(vm).not.toBeNull();
    expect(vm.joinRequests).toHaveLength(1);
    expect(vm.joinRequests[0]!.id).toBe('req-1');
    expect(vm.joinRequests[0]!.driver.name).toBe('John Doe');
  });
});