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

@@ -5,7 +5,6 @@ import type { IRaceRegistrationRepository } from '../../domain/repositories/IRac
import type { IResultRepository } from '../../domain/repositories/IResultRepository';
import type { IStandingRepository } from '../../domain/repositories/IStandingRepository';
import type { DriverRatingProvider } from '../ports/DriverRatingProvider';
import { RacingDomainValidationError } from '../../domain/errors/RacingDomainError';
import type { CompleteRaceCommandDTO } from '../dto/CompleteRaceCommandDTO';
describe('CompleteRaceUseCase', () => {
@@ -97,8 +96,7 @@ describe('CompleteRaceUseCase', () => {
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 () => {
@@ -118,8 +116,7 @@ describe('CompleteRaceUseCase', () => {
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 () => {
@@ -141,7 +138,6 @@ describe('CompleteRaceUseCase', () => {
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');
});
});