fix issues in core

This commit is contained in:
2025-12-23 14:43:49 +01:00
parent 11492d1ff2
commit df5c20c5cc
62 changed files with 480 additions and 334 deletions

View File

@@ -9,7 +9,7 @@ import type { UseCaseOutputPort } from '@core/shared/application';
import type { ApplicationErrorCode } from '@core/shared/errors/ApplicationErrorCode';
import type { ISeasonRepository } from '../../domain/repositories/ISeasonRepository';
import type { ILeagueRepository } from '../../domain/repositories/ILeagueRepository';
import { Season } from '../../domain/entities/Season';
import { Season } from '../../domain/entities/season';
import { League } from '../../domain/entities/League';
describe('GetLeagueSeasonsUseCase', () => {
@@ -83,18 +83,18 @@ describe('GetLeagueSeasonsUseCase', () => {
expect(result.unwrap()).toBeUndefined();
expect(output.present).toHaveBeenCalledTimes(1);
const presented = output.present.mock.calls[0][0] as GetLeagueSeasonsResult;
const presented = output.present.mock.calls[0]?.[0] as GetLeagueSeasonsResult;
expect(presented.league).toBe(league);
expect(presented.seasons).toHaveLength(2);
expect(presented?.league).toBe(league);
expect(presented?.seasons).toHaveLength(2);
expect(presented.seasons[0]!.season).toBe(seasons[0]);
expect(presented.seasons[0]!.isPrimary).toBe(false);
expect(presented.seasons[0]!.isParallelActive).toBe(false);
expect(presented?.seasons[0]?.season).toBe(seasons[0]);
expect(presented?.seasons[0]?.isPrimary).toBe(false);
expect(presented?.seasons[0]?.isParallelActive).toBe(false);
expect(presented.seasons[1]!.season).toBe(seasons[1]);
expect(presented.seasons[1]!.isPrimary).toBe(false);
expect(presented.seasons[1]!.isParallelActive).toBe(false);
expect(presented?.seasons[1]?.season).toBe(seasons[1]);
expect(presented?.seasons[1]?.isPrimary).toBe(false);
expect(presented?.seasons[1]?.isParallelActive).toBe(false);
});
it('should set isParallelActive true for active seasons when multiple active', async () => {
@@ -132,11 +132,11 @@ describe('GetLeagueSeasonsUseCase', () => {
expect(result.unwrap()).toBeUndefined();
expect(output.present).toHaveBeenCalledTimes(1);
const presented = output.present.mock.calls[0][0] as GetLeagueSeasonsResult;
const presented = output.present.mock.calls[0]?.[0] as GetLeagueSeasonsResult;
expect(presented.seasons).toHaveLength(2);
expect(presented.seasons[0]!.isParallelActive).toBe(true);
expect(presented.seasons[1]!.isParallelActive).toBe(true);
expect(presented?.seasons).toHaveLength(2);
expect(presented?.seasons[0]?.isParallelActive).toBe(true);
expect(presented?.seasons[1]?.isParallelActive).toBe(true);
});
it('should return LEAGUE_NOT_FOUND error when league does not exist', async () => {