website refactor
This commit is contained in:
@@ -2,7 +2,6 @@ import { describe, it, expect, beforeEach, vi, type Mock } from 'vitest';
|
||||
import {
|
||||
GetLeagueScheduleUseCase,
|
||||
type GetLeagueScheduleInput,
|
||||
type GetLeagueScheduleResult,
|
||||
type GetLeagueScheduleErrorCode,
|
||||
} from './GetLeagueScheduleUseCase';
|
||||
import type { ApplicationErrorCode } from '@core/shared/errors/ApplicationErrorCode';
|
||||
@@ -10,6 +9,8 @@ import type { League } from '../../domain/entities/League';
|
||||
import { Race } from '../../domain/entities/Race';
|
||||
import type { LeagueRepository } from '../../domain/repositories/LeagueRepository';
|
||||
import type { RaceRepository } from '../../domain/repositories/RaceRepository';
|
||||
import type { Logger } from '@core/shared/domain/Logger';
|
||||
import type { SeasonRepository } from '../../domain/repositories/SeasonRepository';
|
||||
|
||||
describe('GetLeagueScheduleUseCase', () => {
|
||||
let useCase: GetLeagueScheduleUseCase;
|
||||
@@ -42,7 +43,7 @@ describe('GetLeagueScheduleUseCase', () => {
|
||||
error: vi.fn(),
|
||||
} as unknown as Logger;
|
||||
useCase = new GetLeagueScheduleUseCase(leagueRepository as unknown as LeagueRepository,
|
||||
seasonRepository as any,
|
||||
seasonRepository as unknown as SeasonRepository,
|
||||
raceRepository as unknown as RaceRepository,
|
||||
logger);
|
||||
});
|
||||
@@ -109,7 +110,7 @@ describe('GetLeagueScheduleUseCase', () => {
|
||||
raceRepository.findByLeagueId.mockResolvedValue([janRace, febRace]);
|
||||
|
||||
// Season 1 covers January
|
||||
const resultSeason1 = await useCase.execute({ leagueId, seasonId: 'season-jan' } as any);
|
||||
const resultSeason1 = await useCase.execute({ leagueId, seasonId: 'season-jan' });
|
||||
expect(resultSeason1.isOk()).toBe(true);
|
||||
const resultValue1 = resultSeason1.unwrap();
|
||||
expect(resultValue1.seasonId).toBe('season-jan');
|
||||
@@ -117,7 +118,7 @@ describe('GetLeagueScheduleUseCase', () => {
|
||||
expect(resultValue1.races.map(r => r.race.id)).toEqual(['race-jan']);
|
||||
|
||||
// Season 2 covers February
|
||||
const resultSeason2 = await useCase.execute({ leagueId, seasonId: 'season-feb' } as any);
|
||||
const resultSeason2 = await useCase.execute({ leagueId, seasonId: 'season-feb' });
|
||||
expect(resultSeason2.isOk()).toBe(true);
|
||||
const resultValue2 = resultSeason2.unwrap();
|
||||
expect(resultValue2.seasonId).toBe('season-feb');
|
||||
|
||||
Reference in New Issue
Block a user