wip league admin tools
This commit is contained in:
@@ -58,9 +58,15 @@ describe('CancelRaceUseCase', () => {
|
||||
expect(result.isOk()).toBe(true);
|
||||
expect(result.unwrap()).toBeUndefined();
|
||||
expect(raceRepository.findById).toHaveBeenCalledWith(raceId);
|
||||
expect(raceRepository.update).toHaveBeenCalledWith(expect.objectContaining({ id: raceId, status: 'cancelled' }));
|
||||
expect(raceRepository.update).toHaveBeenCalledTimes(1);
|
||||
const updatedRace = (raceRepository.update as Mock).mock.calls[0]?.[0] as Race;
|
||||
expect(updatedRace.id).toBe(raceId);
|
||||
expect(updatedRace.status.toString()).toBe('cancelled');
|
||||
|
||||
expect(output.present).toHaveBeenCalledTimes(1);
|
||||
expect(output.present).toHaveBeenCalledWith({ race: expect.objectContaining({ id: raceId, status: 'cancelled' }) });
|
||||
const presented = (output.present as Mock).mock.calls[0]?.[0] as CancelRaceResult;
|
||||
expect(presented.race.id).toBe(raceId);
|
||||
expect(presented.race.status.toString()).toBe('cancelled');
|
||||
});
|
||||
|
||||
it('should return error if race not found', async () => {
|
||||
|
||||
Reference in New Issue
Block a user