import { GetLeagueMembershipsPresenter } from './GetLeagueMembershipsPresenter';
import type { GetLeagueMembershipsResult } from '@core/racing/application/use-cases/GetLeagueMembershipsUseCase';

describe('GetLeagueMembershipsPresenter', () => {
  it('presents memberships correctly', () => {
    const presenter = new GetLeagueMembershipsPresenter();
    const output: GetLeagueMembershipsResult = {
      // eslint-disable-next-line @typescript-eslint/no-explicit-any
      league: {} as any,
      memberships: [
        {
          // eslint-disable-next-line @typescript-eslint/no-explicit-any
          membership: {
            driverId: 'driver-1',
            role: 'member',
            joinedAt: { toDate: () => new Date('2024-01-01T00:00:00Z') },
          // eslint-disable-next-line @typescript-eslint/no-explicit-any
          } as any,
          // eslint-disable-next-line @typescript-eslint/no-explicit-any
          driver: {
            id: 'driver-1',
            iracingId: '12345',
            name: 'John Doe',
            country: 'US',
            joinedAt: { toDate: () => new Date('2024-01-01T00:00:00Z') },
          } as any,
        },
      ],
    };

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

    expect(vm).not.toBeNull();
    expect(vm!.memberships.members).toHaveLength(1);
    expect(vm!.memberships.members[0]!.driverId).toBe('driver-1');
    expect(vm!.memberships.members[0]!.driver.name).toBe('John Doe');
  });
});