refactor league module (wip)
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
import { LeagueJoinRequestsPresenter } from './LeagueJoinRequestsPresenter';
|
||||
import type { GetLeagueJoinRequestsOutputPort } from '@core/racing/application/ports/output/GetLeagueJoinRequestsOutputPort';
|
||||
import type { GetLeagueJoinRequestsResult } from '@core/racing/application/use-cases/GetLeagueJoinRequestsUseCase';
|
||||
|
||||
describe('LeagueJoinRequestsPresenter', () => {
|
||||
it('presents join requests correctly', () => {
|
||||
const presenter = new LeagueJoinRequestsPresenter();
|
||||
const output: GetLeagueJoinRequestsOutputPort = {
|
||||
const output: GetLeagueJoinRequestsResult = {
|
||||
joinRequests: [
|
||||
{
|
||||
id: 'req-1',
|
||||
@@ -12,17 +12,18 @@ describe('LeagueJoinRequestsPresenter', () => {
|
||||
driverId: 'driver-1',
|
||||
requestedAt: new Date('2023-01-01'),
|
||||
message: 'Please accept me',
|
||||
driver: { id: 'driver-1', name: 'John Doe' },
|
||||
// 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();
|
||||
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');
|
||||
expect(vm.joinRequests).toHaveLength(1);
|
||||
expect(vm.joinRequests[0]!.id).toBe('req-1');
|
||||
expect(vm.joinRequests[0]!.driver.name).toBe('John Doe');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user