From 563bbd3df43db044c22725b15b95e5a35d8917b6 Mon Sep 17 00:00:00 2001 From: Shakker Date: Mon, 11 May 2026 14:28:36 +0100 Subject: [PATCH] test: pin Telegram dispatch drafts --- .../telegram/src/bot-message-dispatch.test.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/extensions/telegram/src/bot-message-dispatch.test.ts b/extensions/telegram/src/bot-message-dispatch.test.ts index cbeb1f139d5..861d978af19 100644 --- a/extensions/telegram/src/bot-message-dispatch.test.ts +++ b/extensions/telegram/src/bot-message-dispatch.test.ts @@ -513,8 +513,9 @@ describe("dispatchTelegramMessage draft streaming", () => { }); expect(draftStream.update).toHaveBeenCalledWith("Hello"); const delivery = expectDeliverRepliesParams({ thread: { id: 777, scope: "dm" } }); - expect(delivery.mediaLocalRoots).toContainEqual( - expect.stringMatching(/[\\/]\.openclaw[\\/]workspace-work$/u), + const mediaLocalRoots = delivery.mediaLocalRoots as string[] | undefined; + expect(mediaLocalRoots?.some((root) => /[\\/]\.openclaw[\\/]workspace-work$/u.test(root))).toBe( + true, ); const dispatchParams = expectDispatchParams({}); expect( @@ -1065,7 +1066,7 @@ describe("dispatchTelegramMessage draft streaming", () => { telegramCfg: { streaming: { mode: "partial" } }, }); - expect(answerDraftStream.update).toHaveBeenNthCalledWith(1, expect.stringMatching(/Exec/)); + expect(answerDraftStream.update.mock.calls[0]?.[0]).toContain("Exec"); expect(answerDraftStream.update).toHaveBeenNthCalledWith(2, "Done "); expect(answerDraftStream.update).toHaveBeenNthCalledWith(3, "Done answer"); expect(answerDraftStream.update).toHaveBeenLastCalledWith("Done answer."); @@ -1135,7 +1136,7 @@ describe("dispatchTelegramMessage draft streaming", () => { }); expect(answerDraftStream.update).toHaveBeenCalledWith( - expect.stringMatching(/`šŸ› ļø git rev-parse --abbrev-ref HEAD`$/), + "Cracking...\n`šŸ› ļø Exec`\n`šŸ› ļø git rev-parse --abbrev-ref HEAD`", ); expect(answerDraftStream.update).not.toHaveBeenCalledWith("Branch is up to date"); expect(answerDraftStream.clear).toHaveBeenCalledTimes(1); @@ -1198,7 +1199,7 @@ describe("dispatchTelegramMessage draft streaming", () => { telegramCfg: { streaming: { mode: "progress", progress: { label: "Shelling" } } }, }); - expect(draftStream.update).toHaveBeenCalledWith(expect.stringMatching(/^Shelling\n`šŸ› ļø Exec`$/)); + expect(draftStream.update).toHaveBeenCalledWith("Shelling\n`šŸ› ļø Exec`"); expect(draftStream.flush).toHaveBeenCalled(); }); @@ -1257,7 +1258,7 @@ describe("dispatchTelegramMessage draft streaming", () => { }); expect(draftStream.update).toHaveBeenCalledWith( - expect.stringMatching(/^Shelling\n`šŸ”Ž Web Search: docs lookup`\n• `tests passed`$/), + "Shelling\n`šŸ”Ž Web Search: docs lookup`\n• `tests passed`", ); expect(draftStream.forceNewMessage).not.toHaveBeenCalled(); expect(draftStream.materialize).not.toHaveBeenCalled();