resolve todos in website
This commit is contained in:
@@ -14,7 +14,12 @@ describe('RaceService', () => {
|
||||
getDetail: vi.fn(),
|
||||
getPageData: vi.fn(),
|
||||
getTotal: vi.fn(),
|
||||
} as Mocked<RacesApiClient>;
|
||||
register: vi.fn(),
|
||||
withdraw: vi.fn(),
|
||||
cancel: vi.fn(),
|
||||
complete: vi.fn(),
|
||||
reopen: vi.fn(),
|
||||
} as unknown as Mocked<RacesApiClient>;
|
||||
|
||||
service = new RaceService(mockApiClient);
|
||||
});
|
||||
@@ -131,4 +136,22 @@ describe('RaceService', () => {
|
||||
await expect(service.getRacesTotal()).rejects.toThrow('API call failed');
|
||||
});
|
||||
});
|
||||
|
||||
describe('reopenRace', () => {
|
||||
it('should call apiClient.reopen with raceId', async () => {
|
||||
const raceId = 'race-123';
|
||||
|
||||
await service.reopenRace(raceId);
|
||||
|
||||
expect(mockApiClient.reopen).toHaveBeenCalledWith(raceId);
|
||||
});
|
||||
|
||||
it('should propagate errors from apiClient.reopen', async () => {
|
||||
const raceId = 'race-123';
|
||||
const error = new Error('API call failed');
|
||||
mockApiClient.reopen.mockRejectedValue(error);
|
||||
|
||||
await expect(service.reopenRace(raceId)).rejects.toThrow('API call failed');
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user