diff options
| author | Bryan Morgan <[email protected]> | 2025-06-25 15:37:23 -0400 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-06-25 19:37:23 +0000 |
| commit | eacbb3551ce12012a0ef9b9338b8b747b2e7161c (patch) | |
| tree | 4a6b195096698787d449d824dd5a5c3ada282694 /packages/core/src/utils/flashFallback.integration.test.ts | |
| parent | 4b5ca6bc777180b2ea11f391e6f612da5072cc3e (diff) | |
changed 429 failover from 3 consecutive to 2 for OAuth users (#1579)
Diffstat (limited to 'packages/core/src/utils/flashFallback.integration.test.ts')
| -rw-r--r-- | packages/core/src/utils/flashFallback.integration.test.ts | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/packages/core/src/utils/flashFallback.integration.test.ts b/packages/core/src/utils/flashFallback.integration.test.ts index 21c40296..cffe9aa5 100644 --- a/packages/core/src/utils/flashFallback.integration.test.ts +++ b/packages/core/src/utils/flashFallback.integration.test.ts @@ -50,16 +50,15 @@ describe('Flash Fallback Integration', () => { expect(result).toBe(true); }); - it('should trigger fallback after 3 consecutive 429 errors for OAuth users', async () => { + it('should trigger fallback after 2 consecutive 429 errors for OAuth users', async () => { let fallbackCalled = false; let fallbackModel = ''; - // Mock function that simulates exactly 3 429 errors, then succeeds after fallback + // Mock function that simulates exactly 2 429 errors, then succeeds after fallback const mockApiCall = vi .fn() .mockRejectedValueOnce(createSimulated429Error()) .mockRejectedValueOnce(createSimulated429Error()) - .mockRejectedValueOnce(createSimulated429Error()) .mockResolvedValueOnce('success after fallback'); // Mock fallback handler @@ -69,9 +68,9 @@ describe('Flash Fallback Integration', () => { return fallbackModel; }); - // Test with OAuth personal auth type, with maxAttempts = 3 to ensure fallback triggers + // Test with OAuth personal auth type, with maxAttempts = 2 to ensure fallback triggers const result = await retryWithBackoff(mockApiCall, { - maxAttempts: 3, + maxAttempts: 2, initialDelayMs: 1, maxDelayMs: 10, shouldRetry: (error: Error) => { @@ -89,8 +88,8 @@ describe('Flash Fallback Integration', () => { AuthType.LOGIN_WITH_GOOGLE_PERSONAL, ); expect(result).toBe('success after fallback'); - // Should have: 3 failures, then fallback triggered, then 1 success after retry reset - expect(mockApiCall).toHaveBeenCalledTimes(4); + // Should have: 2 failures, then fallback triggered, then 1 success after retry reset + expect(mockApiCall).toHaveBeenCalledTimes(3); }); it('should not trigger fallback for API key users', async () => { |
