code quality
Some checks failed
CI / lint-typecheck (pull_request) Failing after 12s
CI / tests (pull_request) Has been skipped
CI / contract-tests (pull_request) Has been skipped
CI / e2e-tests (pull_request) Has been skipped
CI / comment-pr (pull_request) Has been skipped
CI / commit-types (pull_request) Has been skipped
Some checks failed
CI / lint-typecheck (pull_request) Failing after 12s
CI / tests (pull_request) Has been skipped
CI / contract-tests (pull_request) Has been skipped
CI / e2e-tests (pull_request) Has been skipped
CI / comment-pr (pull_request) Has been skipped
CI / commit-types (pull_request) Has been skipped
This commit is contained in:
@@ -5,6 +5,8 @@
|
||||
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
||||
import { GetRatingLeaderboardUseCase } from './GetRatingLeaderboardUseCase';
|
||||
import { Rating } from '../../domain/Rating';
|
||||
import { DriverId } from '../../../racing/domain/entities/DriverId';
|
||||
import { RaceId } from '../../../racing/domain/entities/RaceId';
|
||||
|
||||
const mockRatingRepository = {
|
||||
findByDriver: vi.fn(),
|
||||
@@ -37,37 +39,65 @@ describe('GetRatingLeaderboardUseCase', () => {
|
||||
|
||||
const ratingsD1 = [
|
||||
Rating.create({
|
||||
driverId: 'd1' as any,
|
||||
raceId: 'r1' as any,
|
||||
driverId: DriverId.create('d1'),
|
||||
raceId: RaceId.create('r1'),
|
||||
rating: 1000,
|
||||
components: {} as any,
|
||||
components: {
|
||||
resultsStrength: 0,
|
||||
consistency: 0,
|
||||
cleanDriving: 0,
|
||||
racecraft: 0,
|
||||
reliability: 0,
|
||||
teamContribution: 0,
|
||||
},
|
||||
timestamp: new Date('2023-01-01')
|
||||
}),
|
||||
Rating.create({
|
||||
driverId: 'd1' as any,
|
||||
raceId: 'r2' as any,
|
||||
driverId: DriverId.create('d1'),
|
||||
raceId: RaceId.create('r2'),
|
||||
rating: 1200, // Latest for D1
|
||||
components: {} as any,
|
||||
components: {
|
||||
resultsStrength: 0,
|
||||
consistency: 0,
|
||||
cleanDriving: 0,
|
||||
racecraft: 0,
|
||||
reliability: 0,
|
||||
teamContribution: 0,
|
||||
},
|
||||
timestamp: new Date('2023-01-02')
|
||||
})
|
||||
];
|
||||
|
||||
const ratingsD2 = [
|
||||
Rating.create({
|
||||
driverId: 'd2' as any,
|
||||
raceId: 'r1' as any,
|
||||
driverId: DriverId.create('d2'),
|
||||
raceId: RaceId.create('r1'),
|
||||
rating: 1500, // Latest for D2
|
||||
components: {} as any,
|
||||
components: {
|
||||
resultsStrength: 0,
|
||||
consistency: 0,
|
||||
cleanDriving: 0,
|
||||
racecraft: 0,
|
||||
reliability: 0,
|
||||
teamContribution: 0,
|
||||
},
|
||||
timestamp: new Date('2023-01-01')
|
||||
})
|
||||
];
|
||||
|
||||
const ratingsD3 = [
|
||||
Rating.create({
|
||||
driverId: 'd3' as any,
|
||||
raceId: 'r1' as any,
|
||||
driverId: DriverId.create('d3'),
|
||||
raceId: RaceId.create('r1'),
|
||||
rating: 800, // Latest for D3
|
||||
components: {} as any,
|
||||
components: {
|
||||
resultsStrength: 0,
|
||||
consistency: 0,
|
||||
cleanDriving: 0,
|
||||
racecraft: 0,
|
||||
reliability: 0,
|
||||
teamContribution: 0,
|
||||
},
|
||||
timestamp: new Date('2023-01-01')
|
||||
})
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user