import { describe, expect, it } from "vitest"; import { mergeStreamingText, resolveStreamingCardSendMode } 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");
});
describe("resolveStreamingCardSendMode", () => {
it("prefers message.reply when reply target and root id both exist", () => {
expect(
resolveStreamingCardSendMode({
replyToMessageId: "om_parent",
rootId: "om_topic_root",
}),
).toBe("reply");
});
it("falls back to root create when reply target is absent", () => {
expect(
resolveStreamingCardSendMode({
rootId: "om_topic_root",
}),
).toBe("root_create");
});
it("uses create mode when no reply routing fields are provided", () => {
expect(resolveStreamingCardSendMode()).toBe("create");
expect(
resolveStreamingCardSendMode({
replyInThread: true,
}),
).toBe("create");
});
});
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.1 Sekunden
(vorverarbeitet am 2026-06-10)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.