website refactor

This commit is contained in:
2026-01-17 22:55:03 +01:00
parent 64d9e7fd16
commit 69d4cce7f1
64 changed files with 1146 additions and 1014 deletions

View File

@@ -40,7 +40,8 @@ describe('LeagueService', () => {
const result = await service.getAllLeagues();
expect(mockApiClient.getAllWithCapacityAndScoring).toHaveBeenCalled();
expect(result).toEqual(mockDto);
expect(result.isOk()).toBe(true);
expect(result.unwrap()).toEqual(mockDto);
});
it('should handle empty leagues array', async () => {
@@ -50,14 +51,17 @@ describe('LeagueService', () => {
const result = await service.getAllLeagues();
expect(result).toEqual(mockDto);
expect(result.isOk()).toBe(true);
expect(result.unwrap()).toEqual(mockDto);
});
it('should throw error when apiClient.getAllWithCapacityAndScoring fails', async () => {
const error = new Error('API call failed');
mockApiClient.getAllWithCapacityAndScoring.mockRejectedValue(error);
await expect(service.getAllLeagues()).rejects.toThrow('API call failed');
const result = await service.getAllLeagues();
expect(result.isErr()).toBe(true);
expect(result.getError().message).toBe('API call failed');
});
});
@@ -192,9 +196,10 @@ describe('LeagueService', () => {
mockApiClient.create.mockResolvedValue(mockDto);
await service.createLeague(input);
const result = await service.createLeague(input);
expect(mockApiClient.create).toHaveBeenCalledWith(input);
expect(result).toEqual(mockDto);
});
it('should throw error when apiClient.create fails', async () => {