API client, auth bootstrap and job polling (#42)
CI / ci (push) Successful in 1m32s
CI / ci (pull_request) Successful in 1m33s

Co-authored-by: dev_agent <dev_agent@cubecraftlabs.com>
Co-committed-by: dev_agent <dev_agent@cubecraftlabs.com>
This commit was merged in pull request #42.
This commit is contained in:
2026-10-04 08:46:40 -04:00
committed by approver_agent
parent c899f07b1f
commit 048d5dd71a
18 changed files with 840 additions and 24 deletions
+18
View File
@@ -0,0 +1,18 @@
import { describe, expect, it } from 'vitest'
import { ApiError, createQueryClient, shouldRetry } from './index.ts'
describe('query retries', () => {
it('retry only an ApiError the server marked retryable, a bounded number of times', () => {
expect(shouldRetry(0, new ApiError(503, 'unavailable', 'try later', true))).toBe(true)
expect(shouldRetry(3, new ApiError(503, 'unavailable', 'try later', true))).toBe(false)
expect(shouldRetry(0, new ApiError(401, 'unauthenticated', 'sign in required', false))).toBe(false)
expect(shouldRetry(0, new ApiError(403, 'csrf', 'bad token', false))).toBe(false)
expect(shouldRetry(0, new Error('network down'))).toBe(false)
})
it('are the QueryClient default for queries and mutations', () => {
const options = createQueryClient().getDefaultOptions()
expect(options.queries?.retry).toBe(shouldRetry)
expect(options.mutations?.retry).toBe(shouldRetry)
})
})