fix(quota): normalize DeepSeek timeout errors

This commit is contained in:
Bohdan Triapitsyn
2026-08-03 18:42:31 +03:00
parent 1cc5cfedbb
commit e4fddabb19
4 changed files with 36 additions and 2 deletions
@@ -119,6 +119,15 @@ describe('DeepSeek quota provider', () => {
expect(result.error).toBe('Invalid response from provider');
});
it('reports a normalized timeout error', async () => {
vi.stubGlobal('fetch', vi.fn().mockRejectedValue(new DOMException('The operation timed out.', 'TimeoutError')));
const result = await fetchQuota();
expect(result.ok).toBe(false);
expect(result.error).toBe('Request timed out');
});
it('returns no-quota-data on a 200 payload with no usable balance', async () => {
vi.stubGlobal('fetch', vi.fn().mockResolvedValue(mockResponse({
is_available: true,