test(telegram): cover per-account timeoutSeconds (#863)
Co-authored-by: Snaver <194855+Snaver@users.noreply.github.com>
This commit is contained in:
@@ -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", () => {
|
it("sequentializes updates by chat and thread", () => {
|
||||||
createTelegramBot({ token: "tok" });
|
createTelegramBot({ token: "tok" });
|
||||||
expect(sequentializeSpy).toHaveBeenCalledTimes(1);
|
expect(sequentializeSpy).toHaveBeenCalledTimes(1);
|
||||||
|
|||||||
@@ -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 () => {
|
it("falls back to plain text when Telegram rejects HTML", async () => {
|
||||||
const chatId = "123";
|
const chatId = "123";
|
||||||
|
|||||||
Reference in New Issue
Block a user