mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 02:42:43 +00:00
fix(telegram): skip null/undefined final text payloads
This commit is contained in:
committed by
Peter Steinberger
parent
e6e3a7b497
commit
48d369749c
@@ -1464,6 +1464,21 @@ describe("dispatchTelegramMessage draft streaming", () => {
|
|||||||
expect(draftStream.clear).toHaveBeenCalledTimes(1);
|
expect(draftStream.clear).toHaveBeenCalledTimes(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("skips final payload when text is undefined", async () => {
|
||||||
|
const draftStream = createDraftStream(999);
|
||||||
|
createTelegramDraftStream.mockReturnValue(draftStream);
|
||||||
|
dispatchReplyWithBufferedBlockDispatcher.mockImplementation(async ({ dispatcherOptions }) => {
|
||||||
|
await dispatcherOptions.deliver({ text: undefined as unknown as string }, { kind: "final" });
|
||||||
|
return { queuedFinal: true };
|
||||||
|
});
|
||||||
|
deliverReplies.mockResolvedValue({ delivered: true });
|
||||||
|
|
||||||
|
await dispatchWithContext({ context: createContext() });
|
||||||
|
|
||||||
|
expect(deliverReplies).not.toHaveBeenCalled();
|
||||||
|
expect(draftStream.clear).toHaveBeenCalledTimes(1);
|
||||||
|
});
|
||||||
|
|
||||||
it("falls back when all finals are skipped and clears preview", async () => {
|
it("falls back when all finals are skipped and clears preview", async () => {
|
||||||
const draftStream = createDraftStream(999);
|
const draftStream = createDraftStream(999);
|
||||||
createTelegramDraftStream.mockReturnValue(draftStream);
|
createTelegramDraftStream.mockReturnValue(draftStream);
|
||||||
|
|||||||
Reference in New Issue
Block a user