test(regression): cover recent landed fix paths

This commit is contained in:
Peter Steinberger
2026-03-07 23:07:06 +00:00
parent c76d29208b
commit 7ab49a7fb7
6 changed files with 146 additions and 0 deletions

View File

@@ -97,4 +97,28 @@ describe("telegram bot message processor", () => {
);
expect(runtimeError).toHaveBeenCalledWith(expect.stringContaining("dispatch exploded"));
});
it("swallows fallback delivery failures after dispatch throws", async () => {
const sendMessage = vi.fn().mockRejectedValue(new Error("blocked by user"));
const runtimeError = vi.fn();
buildTelegramMessageContext.mockResolvedValue({
chatId: 123,
route: { sessionKey: "agent:main:main" },
});
dispatchTelegramMessage.mockRejectedValue(new Error("dispatch exploded"));
const processMessage = createTelegramMessageProcessor({
...baseDeps,
bot: { api: { sendMessage } },
runtime: { error: runtimeError },
} as unknown as Parameters<typeof createTelegramMessageProcessor>[0]);
await expect(processSampleMessage(processMessage)).resolves.toBeUndefined();
expect(sendMessage).toHaveBeenCalledWith(
123,
"Something went wrong while processing your request. Please try again.",
undefined,
);
expect(runtimeError).toHaveBeenCalledWith(expect.stringContaining("dispatch exploded"));
});
});