fix core tests

This commit is contained in:
2025-12-23 20:09:02 +01:00
parent 7290fe69b5
commit b5431355ca
25 changed files with 415 additions and 211 deletions

View File

@@ -166,12 +166,29 @@ describe('AcceptSponsorshipRequestUseCase', () => {
balance: 1000,
}),
);
expect(mockLeagueWalletRepo.update).toHaveBeenCalledWith(
expect.objectContaining({
id: 'league1',
balance: expect.objectContaining({ amount: 1400 }),
}),
);
expect(mockLeagueWalletRepo.update).toHaveBeenCalledTimes(1);
const updatedLeagueWallet = (mockLeagueWalletRepo.update as Mock).mock.calls[0]?.[0] as LeagueWallet;
type ToStringable = { toString(): string };
const asString = (value: unknown): string => {
if (typeof value === 'string') return value;
if (
value &&
typeof value === 'object' &&
'toString' in value &&
typeof (value as ToStringable).toString === 'function'
) {
return (value as ToStringable).toString();
}
return String(value);
};
const updatedLeagueWalletId = (updatedLeagueWallet as unknown as { id: unknown }).id;
const updatedLeagueWalletBalanceAmount = (updatedLeagueWallet as unknown as { balance: { amount: number } })
.balance.amount;
expect(asString(updatedLeagueWalletId)).toBe('league1');
expect(updatedLeagueWalletBalanceAmount).toBe(1400);
expect(output.present).toHaveBeenCalledWith({
requestId: 'req1',