code quality
This commit is contained in:
@@ -33,8 +33,8 @@ describe('GetTeamsLeaderboardUseCase', () => {
|
||||
vi.mocked(mockTeamRepository.findAll).mockResolvedValue([mockTeam1, mockTeam2]);
|
||||
|
||||
vi.mocked(mockTeamMembershipRepository.getTeamMembers).mockImplementation(async (teamId) => {
|
||||
if (teamId === 'team-1') return [{ driverId: 'driver-1' }, { driverId: 'driver-2' }] as any;
|
||||
if (teamId === 'team-2') return [{ driverId: 'driver-3' }] as any;
|
||||
if (teamId === 'team-1') return [{ driverId: 'driver-1' }, { driverId: 'driver-2' }] as unknown as Array<{ driverId: string }>;
|
||||
if (teamId === 'team-2') return [{ driverId: 'driver-3' }] as unknown as Array<{ driverId: string }>;
|
||||
return [];
|
||||
});
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ describe('RankingUseCase', () => {
|
||||
['driver-1', { rating: 1500, wins: 2, totalRaces: 10, overallRank: 1 }],
|
||||
['driver-2', { rating: 1200, wins: 0, totalRaces: 5, overallRank: 2 }],
|
||||
]);
|
||||
vi.mocked(mockDriverStatsRepository.getAllStats).mockResolvedValue(mockStatsMap as any);
|
||||
vi.mocked(mockDriverStatsRepository.getAllStats).mockResolvedValue(mockStatsMap as unknown as Map<string, { rating: number; wins: number; totalRaces: number; overallRank: number }>);
|
||||
|
||||
const result = await useCase.getAllDriverRankings();
|
||||
|
||||
|
||||
@@ -14,19 +14,19 @@ describe('ChampionshipAggregator', () => {
|
||||
const championship = {
|
||||
id: 'champ-1',
|
||||
dropScorePolicy: { strategy: 'none' },
|
||||
} as any;
|
||||
} as unknown as { id: string; dropScorePolicy: { strategy: string } };
|
||||
|
||||
const eventPointsByEventId = {
|
||||
'event-1': [
|
||||
{
|
||||
participant: { id: 'p1', type: 'driver' },
|
||||
{
|
||||
participant: { id: 'p1', type: 'driver' },
|
||||
totalPoints: 10,
|
||||
basePoints: 10,
|
||||
bonusPoints: 0,
|
||||
penaltyPoints: 0
|
||||
},
|
||||
{
|
||||
participant: { id: 'p2', type: 'driver' },
|
||||
{
|
||||
participant: { id: 'p2', type: 'driver' },
|
||||
totalPoints: 20,
|
||||
basePoints: 20,
|
||||
bonusPoints: 0,
|
||||
@@ -34,15 +34,15 @@ describe('ChampionshipAggregator', () => {
|
||||
},
|
||||
],
|
||||
'event-2': [
|
||||
{
|
||||
participant: { id: 'p1', type: 'driver' },
|
||||
{
|
||||
participant: { id: 'p1', type: 'driver' },
|
||||
totalPoints: 15,
|
||||
basePoints: 15,
|
||||
bonusPoints: 0,
|
||||
penaltyPoints: 0
|
||||
},
|
||||
],
|
||||
} as any;
|
||||
} as unknown as Record<string, Array<{ participant: { id: string; type: string }; totalPoints: number; basePoints: number; bonusPoints: number; penaltyPoints: number }>>;
|
||||
|
||||
vi.mocked(mockDropScoreApplier.apply).mockImplementation((policy, events) => {
|
||||
const total = events.reduce((sum, e) => sum + e.points, 0);
|
||||
|
||||
Reference in New Issue
Block a user