test: cover transport readiness waits

This commit is contained in:
Peter Steinberger
2026-01-16 20:45:06 +00:00
parent 08c0405f0f
commit e7c42884fc
2 changed files with 60 additions and 0 deletions

View File

@@ -37,4 +37,18 @@ describe("waitForTransportReady", () => {
).rejects.toThrow("test transport not ready");
expect(runtime.error).toHaveBeenCalled();
});
it("returns early when aborted", async () => {
const runtime = { log: vi.fn(), error: vi.fn(), exit: vi.fn() };
const controller = new AbortController();
controller.abort();
await waitForTransportReady({
label: "test transport",
timeoutMs: 200,
runtime,
abortSignal: controller.signal,
check: async () => ({ ok: false, error: "still down" }),
});
expect(runtime.error).not.toHaveBeenCalled();
});
});