more seeds

This commit is contained in:
2025-12-27 11:58:35 +01:00
parent 91612e4256
commit 3efa978ee0
25 changed files with 806 additions and 55 deletions

View File

@@ -18,6 +18,7 @@ describe('LeagueService', () => {
beforeEach(() => {
mockApiClient = {
getAllWithCapacity: vi.fn(),
getAllWithCapacityAndScoring: vi.fn(),
getStandings: vi.fn(),
getTotal: vi.fn(),
getSchedule: vi.fn(),
@@ -30,7 +31,7 @@ describe('LeagueService', () => {
});
describe('getAllLeagues', () => {
it('should call apiClient.getAllWithCapacity and return array of LeagueSummaryViewModel', async () => {
it('should call apiClient.getAllWithCapacityAndScoring and return array of LeagueSummaryViewModel', async () => {
const mockDto = {
totalCount: 2,
leagues: [
@@ -39,11 +40,11 @@ describe('LeagueService', () => {
],
} as any;
mockApiClient.getAllWithCapacity.mockResolvedValue(mockDto);
mockApiClient.getAllWithCapacityAndScoring.mockResolvedValue(mockDto);
const result = await service.getAllLeagues();
expect(mockApiClient.getAllWithCapacity).toHaveBeenCalled();
expect(mockApiClient.getAllWithCapacityAndScoring).toHaveBeenCalled();
expect(result).toHaveLength(2);
expect(result.map((l) => l.id)).toEqual(['league-1', 'league-2']);
});
@@ -51,16 +52,16 @@ describe('LeagueService', () => {
it('should handle empty leagues array', async () => {
const mockDto = { totalCount: 0, leagues: [] } as any;
mockApiClient.getAllWithCapacity.mockResolvedValue(mockDto);
mockApiClient.getAllWithCapacityAndScoring.mockResolvedValue(mockDto);
const result = await service.getAllLeagues();
expect(result).toHaveLength(0);
});
it('should throw error when apiClient.getAllWithCapacity fails', async () => {
it('should throw error when apiClient.getAllWithCapacityAndScoring fails', async () => {
const error = new Error('API call failed');
mockApiClient.getAllWithCapacity.mockRejectedValue(error);
mockApiClient.getAllWithCapacityAndScoring.mockRejectedValue(error);
await expect(service.getAllLeagues()).rejects.toThrow('API call failed');
});