fix issues in core

This commit is contained in:
2025-12-23 11:25:08 +01:00
parent 1efd971032
commit 2854ae3c5c
113 changed files with 1142 additions and 458 deletions

View File

@@ -70,7 +70,9 @@ function createLeagueConfigFormModel(overrides?: Partial<LeagueConfigFormModel>)
};
}
type CreateSeasonErrorCode = ApplicationErrorCode<'LEAGUE_NOT_FOUND' | 'VALIDATION_ERROR' | 'REPOSITORY_ERROR'>;
type CreateSeasonErrorCode = ApplicationErrorCode<'LEAGUE_NOT_FOUND' | 'VALIDATION_ERROR' | 'REPOSITORY_ERROR'> & {
details?: { message: string };
};
describe('CreateSeasonForLeagueUseCase', () => {
const mockLeagueFindById = vi.fn();
@@ -146,9 +148,9 @@ describe('CreateSeasonForLeagueUseCase', () => {
expect(result.unwrap()).toBeUndefined();
expect(output.present).toHaveBeenCalledTimes(1);
const presented = output.present.mock.calls[0][0] as CreateSeasonForLeagueResult;
expect(presented.season).toBeInstanceOf(Season);
expect(presented.league.id).toBe('league-1');
const presented = (output.present as Mock).mock.calls[0]?.[0] as CreateSeasonForLeagueResult;
expect(presented?.season).toBeInstanceOf(Season);
expect(presented?.league.id).toBe('league-1');
});
it('clones configuration from a source season when sourceSeasonId is provided', async () => {
@@ -179,8 +181,8 @@ describe('CreateSeasonForLeagueUseCase', () => {
expect(result.unwrap()).toBeUndefined();
expect(output.present).toHaveBeenCalledTimes(1);
const presented = output.present.mock.calls[0][0] as CreateSeasonForLeagueResult;
expect(presented.season.maxDrivers).toBe(40);
const presented = (output.present as Mock).mock.calls[0]?.[0] as CreateSeasonForLeagueResult;
expect(presented?.season.maxDrivers).toBe(40);
});
it('returns error when league not found and does not call output', async () => {