diff --git a/apps/api/test/archive.test.ts b/apps/api/test/archive.test.ts index f47505d..5f44d16 100644 --- a/apps/api/test/archive.test.ts +++ b/apps/api/test/archive.test.ts @@ -329,6 +329,26 @@ describe("CloudClient retries transient failures", () => { await rm(dir, { recursive: true, force: true }); } }); + + it("retries a 503 blip on a PROPFIND (BIT-31498) and succeeds, instead of failing the whole walk", async () => { + const multistatus = ` +/remote.php/dav/files/peter/FPA/Fotos/ + "abc"10HTTP/1.1 200 OK + +`; + let calls = 0; + const fetchImpl: typeof fetch = async (input) => { + const url = new URL(String(input)); + const who = whoami(url); + if (who) return who; + calls++; + return calls <= 2 ? new Response(null, { status: 503 }) : new Response(multistatus, { status: 207 }); + }; + const client = new CloudClient({ baseUrl: "https://cloud.test", username: "peter", password: "pw" }, fetchImpl); + const { self } = await client.list("/FPA/Fotos"); + expect(self.fileId).toBe("10"); + expect(calls).toBe(3); + }); }); interface Node {