mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 05:47:39 +00:00
test: trim redundant telegram thread+reply combination checks
This commit is contained in:
@@ -939,30 +939,6 @@ describe("sendMessageTelegram", () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it("includes both thread and reply params for forum topic replies", async () => {
|
|
||||||
const chatId = "-1001234567890";
|
|
||||||
const sendMessage = vi.fn().mockResolvedValue({
|
|
||||||
message_id: 57,
|
|
||||||
chat: { id: chatId },
|
|
||||||
});
|
|
||||||
const api = { sendMessage } as unknown as {
|
|
||||||
sendMessage: typeof sendMessage;
|
|
||||||
};
|
|
||||||
|
|
||||||
await sendMessageTelegram(chatId, "forum reply", {
|
|
||||||
token: "tok",
|
|
||||||
api,
|
|
||||||
messageThreadId: 271,
|
|
||||||
replyToMessageId: 500,
|
|
||||||
});
|
|
||||||
|
|
||||||
expect(sendMessage).toHaveBeenCalledWith(chatId, "forum reply", {
|
|
||||||
parse_mode: "HTML",
|
|
||||||
message_thread_id: 271,
|
|
||||||
reply_to_message_id: 500,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it("retries media sends without message_thread_id when thread is missing", async () => {
|
it("retries media sends without message_thread_id when thread is missing", async () => {
|
||||||
const chatId = "123";
|
const chatId = "123";
|
||||||
const threadErr = new Error("400: Bad Request: message thread not found");
|
const threadErr = new Error("400: Bad Request: message thread not found");
|
||||||
@@ -1155,30 +1131,6 @@ describe("sendStickerTelegram", () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it("includes both thread and reply params for forum topic replies", async () => {
|
|
||||||
const chatId = "-1001234567890";
|
|
||||||
const fileId = "CAACAgIAAxkBAAI...sticker_file_id";
|
|
||||||
const sendSticker = vi.fn().mockResolvedValue({
|
|
||||||
message_id: 103,
|
|
||||||
chat: { id: chatId },
|
|
||||||
});
|
|
||||||
const api = { sendSticker } as unknown as {
|
|
||||||
sendSticker: typeof sendSticker;
|
|
||||||
};
|
|
||||||
|
|
||||||
await sendStickerTelegram(chatId, fileId, {
|
|
||||||
token: "tok",
|
|
||||||
api,
|
|
||||||
messageThreadId: 271,
|
|
||||||
replyToMessageId: 500,
|
|
||||||
});
|
|
||||||
|
|
||||||
expect(sendSticker).toHaveBeenCalledWith(chatId, fileId, {
|
|
||||||
message_thread_id: 271,
|
|
||||||
reply_to_message_id: 500,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it("normalizes chat ids with internal prefixes", async () => {
|
it("normalizes chat ids with internal prefixes", async () => {
|
||||||
const sendSticker = vi.fn().mockResolvedValue({
|
const sendSticker = vi.fn().mockResolvedValue({
|
||||||
message_id: 104,
|
message_id: 104,
|
||||||
|
|||||||
Reference in New Issue
Block a user