Retry.Test

_archivetesttypescript
Path: _archive/loom-stale-pre-sprint-snapshot/tests/retry.test.tsRelative: loom-stale-pre-sprint-snapshot/tests/retry.test.tsSubproject: _archiveCategory: archived
Lines: 66Bytes: 2,287Imports: 3Exports: 0has tests

Content Preview

  1. import { describe, expect, test } from "bun:test";
  2. import { withRetry } from "../src/lib/retry";
  3. import { RetryExhaustedError } from "../src/types/errors";
  4. const noSleep = (): Promise<void> => Promise.resolve();
  5. describe("withRetry — exponential backoff + full jitter (HC-6)", () => {
  6. test("succeeds after transient failures", async () => {
  7. let calls = 0;
  8. const result = await withRetry(
  9. "flaky",
  10. () => {
  11. calls++;
  12. return calls < 3 ? Promise.reject(new Error("t