fix(telegram): scope DM topic thread keys by chat id (#31064)

* fix(telegram): scope DM topic thread keys by chat id

* test(telegram): update dm topic session-key expectation

* fix(telegram): parse scoped dm thread ids in outbound recovery

* chore(telegram): format accounts config merge block

* test(nodes): simplify mocked exports for ts tuple spreads
This commit is contained in:
Brian Le
2026-03-01 21:54:45 -05:00
committed by GitHub
parent bbab94c1fe
commit f64d25bd3e
11 changed files with 74 additions and 19 deletions

View File

@@ -32,6 +32,32 @@ describe("telegramOutbound", () => {
expect(result).toEqual({ channel: "telegram", messageId: "tg-text-1", chatId: "123" });
});
it("parses scoped DM thread ids for sendText", async () => {
const sendTelegram = vi.fn().mockResolvedValue({ messageId: "tg-text-2", chatId: "12345" });
const sendText = telegramOutbound.sendText;
expect(sendText).toBeDefined();
await sendText!({
cfg: {},
to: "12345",
text: "<b>hello</b>",
accountId: "work",
threadId: "12345:99",
deps: { sendTelegram },
});
expect(sendTelegram).toHaveBeenCalledWith(
"12345",
"<b>hello</b>",
expect.objectContaining({
textMode: "html",
verbose: false,
accountId: "work",
messageThreadId: 99,
}),
);
});
it("passes media options for sendMedia", async () => {
const sendTelegram = vi.fn().mockResolvedValue({ messageId: "tg-media-1", chatId: "123" });
const sendMedia = telegramOutbound.sendMedia;