Something went wrong. Try again.
The Social Wire — an ATProto publication reader. thesocialwire.app
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334import { describe, expect, it } from "bun:test";import { AppViewRequestError, shouldRetryAppViewRequest,} from "@/lib/thinAppViewClient";
describe("AppView client retry policy", () => { it("retries one retryable response and exposes request diagnostics", () => { const error = new AppViewRequestError({ message: "temporarily unavailable", status: 503, requestId: "req-123", retryable: true, }); expect(error.requestId).toBe("req-123"); expect(shouldRetryAppViewRequest(0, error)).toBe(true); expect(shouldRetryAppViewRequest(1, error)).toBe(false); });
it("never retries malformed requests or ordinary errors", () => { expect( shouldRetryAppViewRequest( 0, new AppViewRequestError({ message: "invalid cursor", status: 400, retryable: false, }) ) ).toBe(false); expect(shouldRetryAppViewRequest(0, new Error("decode failed"))).toBe(false); });});