website refactor

This commit is contained in:
2026-01-16 15:20:25 +01:00
parent 7e02fc3ea5
commit 37b1aa626c
325 changed files with 2167 additions and 2782 deletions

View File

@@ -5,8 +5,6 @@ import {
type GetRaceProtestsResult,
type GetRaceProtestsErrorCode,
} from './GetRaceProtestsUseCase';
import type { ProtestRepository } from '../../domain/repositories/ProtestRepository';
import type { DriverRepository } from '../../domain/repositories/DriverRepository';
import { Protest } from '../../domain/entities/Protest';
import { Driver } from '../../domain/entities/Driver';
import type { ApplicationErrorCode } from '@core/shared/errors/ApplicationErrorCode';
@@ -15,11 +13,12 @@ describe('GetRaceProtestsUseCase', () => {
let useCase: GetRaceProtestsUseCase;
let protestRepository: { findByRaceId: Mock };
let driverRepository: { findById: Mock };
beforeEach(() => {
protestRepository = { findByRaceId: vi.fn() };
driverRepository = { findById: vi.fn() };
useCase = new GetRaceProtestsUseCase(protestRepository as unknown as IProtestRepository,
driverRepository as unknown as IDriverRepository);
useCase = new GetRaceProtestsUseCase(protestRepository as any,
driverRepository as any);
});
it('should return protests with drivers', async () => {
@@ -66,10 +65,7 @@ describe('GetRaceProtestsUseCase', () => {
const result = await useCase.execute(input);
expect(result.isOk()).toBe(true);
expect(result.unwrap()).toBeUndefined();
const presentedRaw = expect(presentedRaw).toBeDefined();
const presented = presentedRaw as GetRaceProtestsResult;
const presented = result.unwrap();
expect(presented.protests).toHaveLength(1);
expect(presented.protests[0]).toEqual(protest);
@@ -85,10 +81,7 @@ describe('GetRaceProtestsUseCase', () => {
const result = await useCase.execute(input);
expect(result.isOk()).toBe(true);
expect(result.unwrap()).toBeUndefined();
const presentedRaw = expect(presentedRaw).toBeDefined();
const presented = presentedRaw as GetRaceProtestsResult;
const presented = result.unwrap();
expect(presented.protests).toEqual([]);
expect(presented.drivers).toEqual([]);
@@ -109,5 +102,5 @@ describe('GetRaceProtestsUseCase', () => {
expect(err.code).toBe('REPOSITORY_ERROR');
expect(err.details.message).toBe('DB error');
});
});
});
});