Files
openclaw/extensions/feishu/src/streaming-card.test.ts
Huaqing.Hao a5a7239182 fix(feishu): non-blocking WS ACK and preserve full streaming card content (#29616)
* fix(feishu): non-blocking ws ack and preserve streaming card full content

* fix(feishu): preserve fragmented streaming text without newline artifacts

---------

Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
2026-03-02 22:17:15 -06:00

19 lines
750 B
TypeScript

import { describe, expect, it } from "vitest";
import { mergeStreamingText } from "./streaming-card.js";
describe("mergeStreamingText", () => {
it("prefers the latest full text when it already includes prior text", () => {
expect(mergeStreamingText("hello", "hello world")).toBe("hello world");
});
it("keeps previous text when the next partial is empty or redundant", () => {
expect(mergeStreamingText("hello", "")).toBe("hello");
expect(mergeStreamingText("hello world", "hello")).toBe("hello world");
});
it("appends fragmented chunks without injecting newlines", () => {
expect(mergeStreamingText("hello wor", "ld")).toBe("hello world");
expect(mergeStreamingText("line1", "line2")).toBe("line1line2");
});
});