fix issues in core
This commit is contained in:
@@ -1,16 +1,15 @@
|
||||
import { describe, it, expect, beforeEach, vi, Mock } from 'vitest';
|
||||
import type { UseCaseOutputPort } from '@core/shared/application/UseCaseOutputPort';
|
||||
import { beforeEach, describe, expect, it, Mock, vi } from 'vitest';
|
||||
import type { IGameRepository } from '../../domain/repositories/IGameRepository';
|
||||
import type { ILeagueMembershipRepository } from '../../domain/repositories/ILeagueMembershipRepository';
|
||||
import type { ILeagueRepository } from '../../domain/repositories/ILeagueRepository';
|
||||
import type { ILeagueScoringConfigRepository } from '../../domain/repositories/ILeagueScoringConfigRepository';
|
||||
import type { ISeasonRepository } from '../../domain/repositories/ISeasonRepository';
|
||||
import {
|
||||
GetAllLeaguesWithCapacityAndScoringUseCase,
|
||||
type GetAllLeaguesWithCapacityAndScoringInput,
|
||||
type GetAllLeaguesWithCapacityAndScoringResult,
|
||||
type LeagueCapacityAndScoringSummary,
|
||||
} from './GetAllLeaguesWithCapacityAndScoringUseCase';
|
||||
import type { ILeagueRepository } from '../../domain/repositories/ILeagueRepository';
|
||||
import type { ILeagueMembershipRepository } from '../../domain/repositories/ILeagueMembershipRepository';
|
||||
import type { ISeasonRepository } from '../../domain/repositories/ISeasonRepository';
|
||||
import type { ILeagueScoringConfigRepository } from '../../domain/repositories/ILeagueScoringConfigRepository';
|
||||
import type { IGameRepository } from '../../domain/repositories/IGameRepository';
|
||||
import type { UseCaseOutputPort } from '@core/shared/application/UseCaseOutputPort';
|
||||
|
||||
describe('GetAllLeaguesWithCapacityAndScoringUseCase', () => {
|
||||
let mockLeagueRepo: { findAll: Mock };
|
||||
@@ -63,18 +62,18 @@ describe('GetAllLeaguesWithCapacityAndScoringUseCase', () => {
|
||||
expect(output.present).toHaveBeenCalledTimes(1);
|
||||
|
||||
const presented =
|
||||
output.present.mock.calls[0][0] as GetAllLeaguesWithCapacityAndScoringResult;
|
||||
output.present.mock.calls[0]?.[0] as GetAllLeaguesWithCapacityAndScoringResult;
|
||||
|
||||
expect(presented.leagues).toHaveLength(1);
|
||||
expect(presented?.leagues).toHaveLength(1);
|
||||
|
||||
const [summary] = presented.leagues as LeagueCapacityAndScoringSummary[];
|
||||
const [summary] = presented?.leagues ?? [];
|
||||
|
||||
expect(summary.league).toEqual(league);
|
||||
expect(summary.currentDrivers).toBe(2);
|
||||
expect(summary.maxDrivers).toBe(30);
|
||||
expect(summary.season).toEqual(season);
|
||||
expect(summary.scoringConfig).toEqual(scoringConfig);
|
||||
expect(summary.game).toEqual(game);
|
||||
expect(summary.preset).toEqual({ id: 'preset1', name: 'Default' });
|
||||
expect(summary?.league).toEqual(league);
|
||||
expect(summary?.currentDrivers).toBe(2);
|
||||
expect(summary?.maxDrivers).toBe(30);
|
||||
expect(summary?.season).toEqual(season);
|
||||
expect(summary?.scoringConfig).toEqual(scoringConfig);
|
||||
expect(summary?.game).toEqual(game);
|
||||
expect(summary?.preset).toEqual({ id: 'preset1', name: 'Default' });
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user