website refactor
This commit is contained in:
@@ -40,9 +40,9 @@ describe('GetLeagueWalletUseCase', () => {
|
||||
findByWalletId: vi.fn(),
|
||||
};
|
||||
|
||||
useCase = new GetLeagueWalletUseCase(leagueRepository as unknown as ILeagueRepository,
|
||||
leagueWalletRepository as unknown as ILeagueWalletRepository,
|
||||
transactionRepository as unknown as ITransactionRepository);
|
||||
useCase = new GetLeagueWalletUseCase(leagueRepository as any,
|
||||
leagueWalletRepository as any,
|
||||
transactionRepository as any);
|
||||
});
|
||||
|
||||
it('returns mapped wallet data when wallet exists', async () => {
|
||||
@@ -123,8 +123,8 @@ describe('GetLeagueWalletUseCase', () => {
|
||||
const result = await useCase.execute(input);
|
||||
|
||||
expect(result.isOk()).toBe(true);
|
||||
expect(result.unwrap()).toBeUndefined();
|
||||
const presented = (expect(presented.wallet).toBe(wallet);
|
||||
const presented = result.unwrap();
|
||||
expect(presented.wallet).toBe(wallet);
|
||||
expect(presented.transactions).toHaveLength(transactions.length);
|
||||
expect(presented.transactions[0]!.id).toEqual(
|
||||
transactions.sort((a, b) => b.createdAt.getTime() - a.createdAt.getTime())[0]!
|
||||
@@ -171,7 +171,7 @@ describe('GetLeagueWalletUseCase', () => {
|
||||
|
||||
expect(err.code).toBe('WALLET_NOT_FOUND');
|
||||
expect(err.details.message).toBe('League wallet not found');
|
||||
});
|
||||
});
|
||||
|
||||
it('returns league not found when league does not exist', async () => {
|
||||
const leagueId = 'league-missing';
|
||||
@@ -190,7 +190,7 @@ describe('GetLeagueWalletUseCase', () => {
|
||||
|
||||
expect(err.code).toBe('LEAGUE_NOT_FOUND');
|
||||
expect(err.details.message).toBe('League not found');
|
||||
});
|
||||
});
|
||||
|
||||
it('returns repository error when repository throws', async () => {
|
||||
const leagueId = 'league-1';
|
||||
@@ -209,5 +209,5 @@ describe('GetLeagueWalletUseCase', () => {
|
||||
|
||||
expect(err.code).toBe('REPOSITORY_ERROR');
|
||||
expect(err.details.message).toBe('DB error');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user