fix(telegram): preserve final overflow state · openclaw/openclaw@bda924b
obviyus
·
2026-05-28
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -505,6 +505,25 @@ describe("createTelegramDraftStream", () => {
|
505 | 505 | ); |
506 | 506 | }); |
507 | 507 | |
| 508 | +it("continues finalizing more than two overflow chunks after a clamped preview", async () => { |
| 509 | +const api = createMockDraftApi(); |
| 510 | +api.sendMessage |
| 511 | +.mockResolvedValueOnce({ message_id: 17 }) |
| 512 | +.mockResolvedValueOnce({ message_id: 42 }) |
| 513 | +.mockResolvedValueOnce({ message_id: 43 }); |
| 514 | +const stream = createDraftStream(api, { maxChars: 10 }); |
| 515 | + |
| 516 | +stream.update("1234567890ABCDEFGHIJKLMNOPQRST"); |
| 517 | +await stream.flush(); |
| 518 | +await stream.stop(); |
| 519 | + |
| 520 | +expect(api.sendMessage).toHaveBeenCalledTimes(3); |
| 521 | +expect(api.sendMessage).toHaveBeenNthCalledWith(1, 123, "1234567890", undefined); |
| 522 | +expect(api.sendMessage).toHaveBeenNthCalledWith(2, 123, "ABCDEFGHIJ", undefined); |
| 523 | +expect(api.sendMessage).toHaveBeenNthCalledWith(3, 123, "KLMNOPQRST", undefined); |
| 524 | +expect(stream.lastDeliveredText?.()).toBe("1234567890ABCDEFGHIJKLMNOPQRST"); |
| 525 | +}); |
| 526 | + |
508 | 527 | it("retains final overflow preview pages", async () => { |
509 | 528 | const api = createMockDraftApi(); |
510 | 529 | api.sendMessage |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。