test: tighten backoff abort coverage

This commit is contained in:
Peter Steinberger 2026-03-14 00:53:39 +00:00
parent e794417623
commit 70d6217dbe
1 changed files with 10 additions and 0 deletions

View File

@ -33,4 +33,14 @@ describe("backoff helpers", () => {
await expect(sleepWithAbort(0, AbortSignal.abort())).resolves.toBeUndefined();
await expect(sleepWithAbort(-5)).resolves.toBeUndefined();
});
it("wraps aborted sleeps with a stable aborted error", async () => {
const controller = new AbortController();
controller.abort();
await expect(sleepWithAbort(5, controller.signal)).rejects.toMatchObject({
message: "aborted",
cause: expect.anything(),
});
});
});