resolve todos in core

This commit is contained in:
2025-12-20 11:02:15 +01:00
parent 7bbad511e2
commit a87cf27fb9
10 changed files with 396 additions and 199 deletions

View File

@@ -69,43 +69,43 @@ describe('GetDriversLeaderboardUseCase', () => {
return Promise.resolve({ avatarUrl: 'avatar-default' });
});
const result = await useCase.execute();
const result = await useCase.execute();
expect(result.isOk()).toBe(true);
expect(result.value).toEqual({
drivers: [
{
id: 'driver1',
name: 'Driver One',
rating: 2500,
skillLevel: 'Pro',
nationality: 'US',
racesCompleted: 10,
wins: 5,
podiums: 7,
isActive: true,
rank: 1,
avatarUrl: 'avatar-driver1',
},
{
id: 'driver2',
name: 'Driver Two',
rating: 2400,
skillLevel: 'Pro',
nationality: 'US',
racesCompleted: 8,
wins: 3,
podiums: 4,
isActive: true,
rank: 2,
avatarUrl: 'avatar-driver2',
},
],
totalRaces: 18,
totalWins: 8,
activeCount: 2,
});
});
expect(result.isOk()).toBe(true);
expect(result.value).toEqual({
drivers: [
{
id: 'driver1',
name: 'Driver One',
rating: 2500,
skillLevel: 'advanced',
nationality: 'US',
racesCompleted: 10,
wins: 5,
podiums: 7,
isActive: true,
rank: 1,
avatarUrl: 'avatar-driver1',
},
{
id: 'driver2',
name: 'Driver Two',
rating: 2400,
skillLevel: 'intermediate',
nationality: 'US',
racesCompleted: 8,
wins: 3,
podiums: 4,
isActive: true,
rank: 2,
avatarUrl: 'avatar-driver2',
},
],
totalRaces: 18,
totalWins: 8,
activeCount: 2,
});
});
it('should return empty result when no drivers', async () => {
const useCase = new GetDriversLeaderboardUseCase(
@@ -147,30 +147,30 @@ describe('GetDriversLeaderboardUseCase', () => {
mockDriverStatsGetDriverStats.mockReturnValue(null);
mockGetDriverAvatar.mockResolvedValue({ avatarUrl: 'avatar-driver1' });
const result = await useCase.execute();
const result = await useCase.execute();
expect(result.isOk()).toBe(true);
expect(result.value).toEqual({
drivers: [
{
id: 'driver1',
name: 'Driver One',
rating: 2500,
skillLevel: 'Pro',
nationality: 'US',
racesCompleted: 0,
wins: 0,
podiums: 0,
isActive: true,
rank: 1,
avatarUrl: 'avatar-driver1',
},
],
totalRaces: 0,
totalWins: 0,
activeCount: 1,
});
});
expect(result.isOk()).toBe(true);
expect(result.value).toEqual({
drivers: [
{
id: 'driver1',
name: 'Driver One',
rating: 2500,
skillLevel: 'advanced',
nationality: 'US',
racesCompleted: 0,
wins: 0,
podiums: 0,
isActive: false,
rank: 1,
avatarUrl: 'avatar-driver1',
},
],
totalRaces: 0,
totalWins: 0,
activeCount: 0,
});
});
it('should return error when repository throws', async () => {
const useCase = new GetDriversLeaderboardUseCase(