test: tighten infra helper assertions

This commit is contained in:
Peter Steinberger
2026-05-11 12:11:36 +01:00
parent c1e4b4d2a9
commit 2cd08508ea
2 changed files with 7 additions and 9 deletions

View File

@@ -105,7 +105,7 @@ describe("wrapFetchWithAbortSignal", () => {
duplex: "half",
} as RequestInit & { duplex: "half" });
expect(getSeenInit()).toMatchObject({ duplex: "half" });
expect((getSeenInit() as (RequestInit & { duplex?: string }) | undefined)?.duplex).toBe("half");
});
it("converts foreign abort signals to native controllers", async () => {

View File

@@ -152,14 +152,12 @@ describe("retryAsync", () => {
vi.useRealTimers();
}
expect(res).toBe("ok");
expect(onRetry).toHaveBeenCalledWith(
expect.objectContaining({
attempt: 1,
maxAttempts: 2,
err,
label: "telegram",
}),
);
expect(onRetry).toHaveBeenCalledOnce();
const retryEvent = onRetry.mock.calls[0]?.[0];
expect(retryEvent?.attempt).toBe(1);
expect(retryEvent?.maxAttempts).toBe(2);
expect(retryEvent?.err).toBe(err);
expect(retryEvent?.label).toBe("telegram");
});
it("retries immediately when the resolved delay is zero", async () => {