29 lines
1.0 KiB
TypeScript
29 lines
1.0 KiB
TypeScript
import { LeagueJoinRequestsPresenter } from './LeagueJoinRequestsPresenter';
|
|
import type { GetLeagueJoinRequestsResult } from '@core/racing/application/use-cases/GetLeagueJoinRequestsUseCase';
|
|
|
|
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 any,
|
|
},
|
|
],
|
|
};
|
|
|
|
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');
|
|
});
|
|
}); |