website refactor
This commit is contained in:
@@ -317,4 +317,41 @@ describe('DriverService', () => {
|
||||
expect(getProfileOverviewUseCase.execute).toHaveBeenCalledWith({ driverId: 'd1' });
|
||||
expect(driverProfilePresenter.getResponseModel).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('getDriverLiveries executes use case and returns presenter model', async () => {
|
||||
const getDriverLiveriesUseCase = { execute: vi.fn(async () => Result.ok(undefined)) };
|
||||
const getDriverLiveriesPresenter = {
|
||||
present: vi.fn(),
|
||||
getResponseModel: vi.fn(() => ({ liveries: [] }))
|
||||
};
|
||||
const driverPresenter = {
|
||||
setMediaResolver: vi.fn(),
|
||||
setBaseUrl: vi.fn(),
|
||||
present: vi.fn(),
|
||||
getResponseModel: vi.fn(() => null)
|
||||
};
|
||||
|
||||
const service = new DriverService(
|
||||
{ execute: vi.fn() } as any,
|
||||
{ execute: vi.fn() } as any,
|
||||
getDriverLiveriesUseCase as any,
|
||||
{ execute: vi.fn() } as any,
|
||||
{ execute: vi.fn() } as any,
|
||||
{ execute: vi.fn() } as any,
|
||||
{ findById: vi.fn() } as any,
|
||||
logger as any,
|
||||
{ getResponseModel: vi.fn(() => ({ items: [] })) } as any,
|
||||
{ getResponseModel: vi.fn(() => ({ totalDrivers: 0 })) } as any,
|
||||
{ getResponseModel: vi.fn(() => ({ success: true })) } as any,
|
||||
{ getResponseModel: vi.fn(() => ({ isRegistered: false })) } as any,
|
||||
driverPresenter as any,
|
||||
{ getResponseModel: vi.fn(() => ({ profile: {} })) } as any,
|
||||
getDriverLiveriesPresenter as any,
|
||||
);
|
||||
|
||||
await expect(service.getDriverLiveries('d1')).resolves.toEqual({ liveries: [] });
|
||||
expect(getDriverLiveriesUseCase.execute).toHaveBeenCalledWith({ driverId: 'd1' });
|
||||
expect(getDriverLiveriesPresenter.present).toHaveBeenCalled();
|
||||
expect(getDriverLiveriesPresenter.getResponseModel).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user