test: pin Telegram dispatch drafts

This commit is contained in:
Shakker
2026-05-11 14:28:36 +01:00
parent ee5b06f9fe
commit 563bbd3df4

View File

@@ -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();