website refactor
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { describe, it, expect, vi, Mocked } from 'vitest';
|
||||
import { LeagueWalletService } from './LeagueWalletService';
|
||||
import { WalletsApiClient } from '../../api/wallets/WalletsApiClient';
|
||||
import { WalletsApiClient } from '@/lib/api/wallets/WalletsApiClient';
|
||||
import { LeagueWalletViewModel } from '@/lib/view-models/LeagueWalletViewModel';
|
||||
|
||||
describe('LeagueWalletService', () => {
|
||||
@@ -97,27 +97,5 @@ describe('LeagueWalletService', () => {
|
||||
|
||||
await expect(service.withdraw(leagueId, amount, currency, seasonId, destinationAccount)).rejects.toThrow('Withdrawal failed');
|
||||
});
|
||||
|
||||
it('should block multiple rapid calls due to throttle', async () => {
|
||||
const leagueId = 'league-123';
|
||||
const amount = 500;
|
||||
const currency = 'USD';
|
||||
const seasonId = 'season-456';
|
||||
const destinationAccount = 'account-789';
|
||||
|
||||
const mockResponse = { success: true };
|
||||
mockApiClient.withdrawFromLeagueWallet.mockResolvedValue(mockResponse);
|
||||
|
||||
// First call should succeed
|
||||
await service.withdraw(leagueId, amount, currency, seasonId, destinationAccount);
|
||||
|
||||
// Reset mock
|
||||
mockApiClient.withdrawFromLeagueWallet.mockClear();
|
||||
|
||||
// Immediate second call should be blocked by throttle and throw error
|
||||
await expect(service.withdraw(leagueId, amount, currency, seasonId, destinationAccount)).rejects.toThrow('Request blocked due to rate limiting');
|
||||
|
||||
expect(mockApiClient.withdrawFromLeagueWallet).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user