import { describe, expect, it } from "vitest"; import { fetchFailure } from "../src/delivery/zerozero.js"; describe("zerozero fetch errors", () => { it("keeps the socket code that fetch hides on cause", () => { const err = new TypeError("fetch failed"); (err as { cause?: unknown }).cause = { code: "ETIMEDOUT", message: "connect ETIMEDOUT" }; expect(fetchFailure(err)).toBe("fetch failed (ETIMEDOUT)"); }); it("joins every address error when happy eyeballs fails them all", () => { const err = new TypeError("fetch failed"); (err as { cause?: unknown }).cause = { errors: [{ code: "ENETUNREACH" }, { code: "ECONNREFUSED" }] }; expect(fetchFailure(err)).toBe("fetch failed (ENETUNREACH, ECONNREFUSED)"); }); });