Skip to main content

Examples with Bun

import { describe, it, expect } from "bun:test";
import trybox, { run } from "trybox";
import { computeBackoffDelay } from "trybox/dist/utils";

describe("run: success", () => {
  it("returns ok with data", async () => {
    const r = await run(async () => 42);
    expect(r.ok).toBe(true);
  });
});

describe("utils: backoff", () => {
  it("linear/exponential/fibonacci", () => {
    expect(computeBackoffDelay("linear", 100, 3)).toBe(100);
  });
});