fix(telegram): skip stopped draft finalization · openclaw/openclaw@8677310
obviyus
·
2026-05-28
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -172,6 +172,21 @@ describe("createTelegramDraftStream", () => {
|
172 | 172 | }, |
173 | 173 | ); |
174 | 174 | |
| 175 | +it("does not finalize stale preview text after a stopped send failure", async () => { |
| 176 | +const api = createMockDraftApi(); |
| 177 | +api.sendMessage.mockRejectedValueOnce(new Error("temporary send failure")); |
| 178 | +const warn = vi.fn(); |
| 179 | +const stream = createDraftStream(api, { warn }); |
| 180 | + |
| 181 | +stream.update("Hello"); |
| 182 | +await stream.flush(); |
| 183 | +await stream.stop(); |
| 184 | + |
| 185 | +expect(api.sendMessage).toHaveBeenCalledTimes(1); |
| 186 | +expect(api.sendMessage).toHaveBeenCalledWith(123, "Hello", undefined); |
| 187 | +expect(warn).toHaveBeenCalledWith("telegram stream preview failed: temporary send failure"); |
| 188 | +}); |
| 189 | + |
175 | 190 | it("keeps allow_sending_without_reply on message previews that target a reply", async () => { |
176 | 191 | const api = createMockDraftApi(); |
177 | 192 | const stream = createDraftStream(api, { |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。