This commit is contained in:
2025-12-16 21:05:01 +01:00
parent f61e3a4e5a
commit 7532c7ed6d
207 changed files with 7861 additions and 2606 deletions

View File

@@ -6,7 +6,6 @@ import type { IResultRepository } from '../../domain/repositories/IResultReposit
import type { IStandingRepository } from '../../domain/repositories/IStandingRepository';
import type { DriverRatingProvider } from '../ports/DriverRatingProvider';
import { RatingUpdateService } from '@core/identity/domain/services/RatingUpdateService';
import { RacingDomainValidationError } from '../../domain/errors/RacingDomainError';
import type { CompleteRaceCommandDTO } from '../dto/CompleteRaceCommandDTO';
describe('CompleteRaceUseCaseWithRatings', () => {
@@ -107,8 +106,7 @@ describe('CompleteRaceUseCaseWithRatings', () => {
const result = await useCase.execute(command);
expect(result.isErr()).toBe(true);
expect(result.unwrapErr()).toBeInstanceOf(RacingDomainValidationError);
expect(result.unwrapErr().message).toBe('Race not found');
expect(result.unwrapErr().code).toBe('RACE_NOT_FOUND');
});
it('should return error when no registered drivers', async () => {
@@ -128,8 +126,7 @@ describe('CompleteRaceUseCaseWithRatings', () => {
const result = await useCase.execute(command);
expect(result.isErr()).toBe(true);
expect(result.unwrapErr()).toBeInstanceOf(RacingDomainValidationError);
expect(result.unwrapErr().message).toBe('Cannot complete race with no registered drivers');
expect(result.unwrapErr().code).toBe('NO_REGISTERED_DRIVERS');
});
it('should return error when repository throws', async () => {
@@ -151,7 +148,6 @@ describe('CompleteRaceUseCaseWithRatings', () => {
const result = await useCase.execute(command);
expect(result.isErr()).toBe(true);
expect(result.unwrapErr()).toBeInstanceOf(RacingDomainValidationError);
expect(result.unwrapErr().message).toBe('DB error');
expect(result.unwrapErr().code).toBe('UNKNOWN_ERROR');
});
});