website refactor
This commit is contained in:
@@ -36,7 +36,7 @@ function getUnknownString(value: unknown): string | null {
|
||||
return null;
|
||||
}
|
||||
|
||||
function createFakeLeagueRepository(seed: Array<{ id: string }>): ILeagueRepository {
|
||||
function createFakeLeagueRepository(seed: Array<{ id: string }>): LeagueRepository {
|
||||
const leagues: League[] = seed.map(({ id }) =>
|
||||
League.create({
|
||||
id,
|
||||
@@ -120,13 +120,13 @@ function createLeagueConfigFormModel(overrides?: Partial<LeagueConfigFormModel>)
|
||||
describe('CreateSeasonForLeagueUseCase', () => {
|
||||
function setup() {
|
||||
const leagueRepo = createFakeLeagueRepository([{ id: 'league-1' }]);
|
||||
const seasonRepo: ISeasonRepository = {
|
||||
const seasonRepo: SeasonRepository = {
|
||||
add: vi.fn(),
|
||||
findById: vi.fn(),
|
||||
update: vi.fn(),
|
||||
listByLeague: vi.fn(),
|
||||
listActiveByLeague: vi.fn(),
|
||||
} as unknown as ISeasonRepository;
|
||||
} as unknown as SeasonRepository;
|
||||
|
||||
const useCase = new CreateSeasonForLeagueUseCase(leagueRepo, seasonRepo);
|
||||
|
||||
@@ -233,13 +233,13 @@ describe('CreateSeasonForLeagueUseCase', () => {
|
||||
|
||||
it('returns LEAGUE_NOT_FOUND error when league does not exist', async () => {
|
||||
const leagueRepo = createFakeLeagueRepository([]);
|
||||
const seasonRepo: ISeasonRepository = {
|
||||
const seasonRepo: SeasonRepository = {
|
||||
add: vi.fn(),
|
||||
findById: vi.fn(),
|
||||
update: vi.fn(),
|
||||
listByLeague: vi.fn(),
|
||||
listActiveByLeague: vi.fn(),
|
||||
} as unknown as ISeasonRepository;
|
||||
} as unknown as SeasonRepository;
|
||||
|
||||
const useCase = new CreateSeasonForLeagueUseCase(leagueRepo, seasonRepo);
|
||||
|
||||
@@ -261,13 +261,13 @@ describe('CreateSeasonForLeagueUseCase', () => {
|
||||
describe('ListSeasonsForLeagueUseCase', () => {
|
||||
function setup() {
|
||||
const leagueRepo = createFakeLeagueRepository([{ id: 'league-1' }]);
|
||||
const seasonRepo: ISeasonRepository = {
|
||||
const seasonRepo: SeasonRepository = {
|
||||
add: vi.fn(),
|
||||
findById: vi.fn(),
|
||||
update: vi.fn(),
|
||||
listByLeague: vi.fn(),
|
||||
listActiveByLeague: vi.fn(),
|
||||
} as unknown as ISeasonRepository;
|
||||
} as unknown as SeasonRepository;
|
||||
|
||||
const useCase = new ListSeasonsForLeagueUseCase(leagueRepo, seasonRepo);
|
||||
|
||||
@@ -317,13 +317,13 @@ describe('ListSeasonsForLeagueUseCase', () => {
|
||||
|
||||
it('returns LEAGUE_NOT_FOUND error when league does not exist', async () => {
|
||||
const leagueRepo = createFakeLeagueRepository([]);
|
||||
const seasonRepo: ISeasonRepository = {
|
||||
const seasonRepo: SeasonRepository = {
|
||||
add: vi.fn(),
|
||||
findById: vi.fn(),
|
||||
update: vi.fn(),
|
||||
listByLeague: vi.fn(),
|
||||
listActiveByLeague: vi.fn(),
|
||||
} as unknown as ISeasonRepository;
|
||||
} as unknown as SeasonRepository;
|
||||
|
||||
const useCase = new ListSeasonsForLeagueUseCase(leagueRepo, seasonRepo);
|
||||
|
||||
@@ -339,13 +339,13 @@ describe('ListSeasonsForLeagueUseCase', () => {
|
||||
describe('GetSeasonDetailsUseCase', () => {
|
||||
function setup(leagueSeed: Array<{ id: string }>) {
|
||||
const leagueRepo = createFakeLeagueRepository(leagueSeed);
|
||||
const seasonRepo: ISeasonRepository = {
|
||||
const seasonRepo: SeasonRepository = {
|
||||
add: vi.fn(),
|
||||
findById: vi.fn(),
|
||||
update: vi.fn(),
|
||||
listByLeague: vi.fn(),
|
||||
listActiveByLeague: vi.fn(),
|
||||
} as unknown as ISeasonRepository;
|
||||
} as unknown as SeasonRepository;
|
||||
|
||||
const useCase = new GetSeasonDetailsUseCase(leagueRepo, seasonRepo);
|
||||
|
||||
@@ -424,13 +424,13 @@ describe('GetSeasonDetailsUseCase', () => {
|
||||
describe('ManageSeasonLifecycleUseCase', () => {
|
||||
function setup() {
|
||||
const leagueRepo = createFakeLeagueRepository([{ id: 'league-1' }]);
|
||||
const seasonRepo: ISeasonRepository = {
|
||||
const seasonRepo: SeasonRepository = {
|
||||
add: vi.fn(),
|
||||
findById: vi.fn(),
|
||||
update: vi.fn(),
|
||||
listByLeague: vi.fn(),
|
||||
listActiveByLeague: vi.fn(),
|
||||
} as unknown as ISeasonRepository;
|
||||
} as unknown as SeasonRepository;
|
||||
|
||||
const useCase = new ManageSeasonLifecycleUseCase(leagueRepo, seasonRepo);
|
||||
|
||||
@@ -519,13 +519,13 @@ describe('ManageSeasonLifecycleUseCase', () => {
|
||||
|
||||
it('returns LEAGUE_NOT_FOUND when league does not exist', async () => {
|
||||
const leagueRepo = createFakeLeagueRepository([]);
|
||||
const seasonRepo: ISeasonRepository = {
|
||||
const seasonRepo: SeasonRepository = {
|
||||
add: vi.fn(),
|
||||
findById: vi.fn(),
|
||||
update: vi.fn(),
|
||||
listByLeague: vi.fn(),
|
||||
listActiveByLeague: vi.fn(),
|
||||
} as unknown as ISeasonRepository;
|
||||
} as unknown as SeasonRepository;
|
||||
|
||||
const useCase = new ManageSeasonLifecycleUseCase(leagueRepo, seasonRepo);
|
||||
|
||||
@@ -545,13 +545,13 @@ describe('ManageSeasonLifecycleUseCase', () => {
|
||||
|
||||
it('returns SEASON_NOT_FOUND when season does not belong to league', async () => {
|
||||
const leagueRepo = createFakeLeagueRepository([{ id: 'league-1' }]);
|
||||
const seasonRepo: ISeasonRepository = {
|
||||
const seasonRepo: SeasonRepository = {
|
||||
add: vi.fn(),
|
||||
findById: vi.fn(),
|
||||
update: vi.fn(),
|
||||
listByLeague: vi.fn(),
|
||||
listActiveByLeague: vi.fn(),
|
||||
} as unknown as ISeasonRepository;
|
||||
} as unknown as SeasonRepository;
|
||||
|
||||
const useCase = new ManageSeasonLifecycleUseCase(leagueRepo, seasonRepo);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user