diff --git a/src/telegram/bot.create-telegram-bot.installs-grammy-throttler.test.ts b/src/telegram/bot.create-telegram-bot.installs-grammy-throttler.test.ts index 9fa973947..46cb6742c 100644 --- a/src/telegram/bot.create-telegram-bot.installs-grammy-throttler.test.ts +++ b/src/telegram/bot.create-telegram-bot.installs-grammy-throttler.test.ts @@ -211,6 +211,27 @@ describe("createTelegramBot", () => { }), ); }); + it("prefers per-account timeoutSeconds overrides", () => { + loadConfig.mockReturnValue({ + channels: { + telegram: { + dmPolicy: "open", + allowFrom: ["*"], + timeoutSeconds: 60, + accounts: { + foo: { timeoutSeconds: 61 }, + }, + }, + }, + }); + createTelegramBot({ token: "tok", accountId: "foo" }); + expect(botCtorSpy).toHaveBeenCalledWith( + "tok", + expect.objectContaining({ + client: expect.objectContaining({ timeoutSeconds: 61 }), + }), + ); + }); it("sequentializes updates by chat and thread", () => { createTelegramBot({ token: "tok" }); expect(sequentializeSpy).toHaveBeenCalledTimes(1); diff --git a/src/telegram/send.returns-undefined-empty-input.test.ts b/src/telegram/send.returns-undefined-empty-input.test.ts index 4027c7eac..e8edbe5cb 100644 --- a/src/telegram/send.returns-undefined-empty-input.test.ts +++ b/src/telegram/send.returns-undefined-empty-input.test.ts @@ -104,6 +104,23 @@ describe("sendMessageTelegram", () => { }), ); }); + it("prefers per-account timeoutSeconds overrides", async () => { + loadConfig.mockReturnValue({ + channels: { + telegram: { + timeoutSeconds: 60, + accounts: { foo: { timeoutSeconds: 61 } }, + }, + }, + }); + await sendMessageTelegram("123", "hi", { token: "tok", accountId: "foo" }); + expect(botCtorSpy).toHaveBeenCalledWith( + "tok", + expect.objectContaining({ + client: expect.objectContaining({ timeoutSeconds: 61 }), + }), + ); + }); it("falls back to plain text when Telegram rejects HTML", async () => { const chatId = "123";