mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-05 23:40:21 +00:00
32 lines
977 B
TypeScript
32 lines
977 B
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { resolveSilentReplyFallbackText } from "./pi-embedded-subscribe.handlers.messages.js";
|
|
|
|
describe("resolveSilentReplyFallbackText", () => {
|
|
it("replaces NO_REPLY with latest messaging tool text when available", () => {
|
|
expect(
|
|
resolveSilentReplyFallbackText({
|
|
text: "NO_REPLY",
|
|
messagingToolSentTexts: ["first", "final delivered text"],
|
|
}),
|
|
).toBe("final delivered text");
|
|
});
|
|
|
|
it("keeps original text when response is not NO_REPLY", () => {
|
|
expect(
|
|
resolveSilentReplyFallbackText({
|
|
text: "normal assistant reply",
|
|
messagingToolSentTexts: ["final delivered text"],
|
|
}),
|
|
).toBe("normal assistant reply");
|
|
});
|
|
|
|
it("keeps NO_REPLY when there is no messaging tool text to mirror", () => {
|
|
expect(
|
|
resolveSilentReplyFallbackText({
|
|
text: "NO_REPLY",
|
|
messagingToolSentTexts: [],
|
|
}),
|
|
).toBe("NO_REPLY");
|
|
});
|
|
});
|