fix: normalize abort signals for telegram fetch

This commit is contained in:
Peter Steinberger
2026-01-21 16:46:49 +00:00
parent fb164b321e
commit 0e003cb7f1
7 changed files with 88 additions and 24 deletions

View File

@@ -284,13 +284,12 @@ describe("createTelegramBot", () => {
(globalThis as { Bun?: unknown }).Bun = {};
createTelegramBot({ token: "tok" });
const fetchImpl = resolveTelegramFetch();
expect(fetchImpl).toBe(fetchSpy);
expect(botCtorSpy).toHaveBeenCalledWith(
"tok",
expect.objectContaining({
client: expect.objectContaining({ fetch: fetchSpy }),
}),
);
expect(fetchImpl).toBeTypeOf("function");
expect(fetchImpl).not.toBe(fetchSpy);
const clientFetch = (botCtorSpy.mock.calls[0]?.[1] as { client?: { fetch?: unknown } })
?.client?.fetch;
expect(clientFetch).toBeTypeOf("function");
expect(clientFetch).not.toBe(fetchSpy);
} finally {
globalThis.fetch = originalFetch;
if (originalBun === undefined) {