website refactor

This commit is contained in:
2026-01-16 15:20:25 +01:00
parent 7e02fc3ea5
commit 37b1aa626c
325 changed files with 2167 additions and 2782 deletions

View File

@@ -9,8 +9,9 @@ import type { LeagueRepository } from '../../domain/repositories/LeagueRepositor
import type { ApplicationErrorCode } from '@core/shared/errors/ApplicationErrorCode';
describe('GetLeagueAdminUseCase', () => {
let mockLeagueRepo: ILeagueRepository;
let mockLeagueRepo: any;
let mockFindById: Mock;
beforeEach(() => {
mockFindById = vi.fn();
mockLeagueRepo = {
@@ -22,9 +23,8 @@ describe('GetLeagueAdminUseCase', () => {
exists: vi.fn(),
findByOwnerId: vi.fn(),
searchByName: vi.fn(),
} as ILeagueRepository;
});
};
});
const createUseCase = () => new GetLeagueAdminUseCase(mockLeagueRepo);
@@ -42,7 +42,7 @@ describe('GetLeagueAdminUseCase', () => {
const error = result.unwrapErr() as ApplicationErrorCode<GetLeagueAdminErrorCode, { message: string }>;
expect(error.code).toBe('LEAGUE_NOT_FOUND');
expect(error.details.message).toBe('League not found');
});
});
it('should return league data when league found', async () => {
const league = { id: 'league1', ownerId: 'owner1' };
@@ -52,8 +52,8 @@ describe('GetLeagueAdminUseCase', () => {
const result = await useCase.execute(params);
expect(result.isOk()).toBe(true);
expect(result.unwrap()).toBeUndefined();
const presented = expect(presented.league.id).toBe('league1');
const presented = result.unwrap();
expect(presented.league.id).toBe('league1');
expect(presented.league.ownerId).toBe('owner1');
});
@@ -68,5 +68,5 @@ describe('GetLeagueAdminUseCase', () => {
const error = result.unwrapErr() as ApplicationErrorCode<GetLeagueAdminErrorCode, { message: string }>;
expect(error.code).toBe('REPOSITORY_ERROR');
expect(error.details.message).toBe('Repository failure');
});
});
});
});