fix(telegram): honor timeoutSeconds (thanks @Snaver) (#863)

This commit is contained in:
Peter Steinberger
2026-01-14 10:09:26 +00:00
parent 802c02eb74
commit 9930ba91c5
10 changed files with 122 additions and 50 deletions

View File

@@ -80,7 +80,9 @@ vi.mock("grammy", () => ({
command = commandSpy;
constructor(
public token: string,
public options?: { client?: { fetch?: typeof fetch } },
public options?: {
client?: { fetch?: typeof fetch; timeoutSeconds?: number };
},
) {
botCtorSpy(token, options);
}
@@ -195,6 +197,20 @@ describe("createTelegramBot", () => {
}
}
});
it("passes timeoutSeconds even without a custom fetch", () => {
loadConfig.mockReturnValue({
channels: {
telegram: { dmPolicy: "open", allowFrom: ["*"], timeoutSeconds: 60 },
},
});
createTelegramBot({ token: "tok" });
expect(botCtorSpy).toHaveBeenCalledWith(
"tok",
expect.objectContaining({
client: expect.objectContaining({ timeoutSeconds: 60 }),
}),
);
});
it("sequentializes updates by chat and thread", () => {
createTelegramBot({ token: "tok" });
expect(sequentializeSpy).toHaveBeenCalledTimes(1);