Files
openclaw/extensions/googlechat/src/monitor-durable.test.ts
Peter Steinberger 8756cc4a3b fix(googlechat): keep off-mode replies out of threads (#104402)
* fix(googlechat): align reply and typing targets

Co-authored-by: Jai Govindani <jai.g@ewa-services.com>

Co-authored-by: Neerav Makwana <261249544+neeravmakwana@users.noreply.github.com>

Co-authored-by: banddude <127166397+banddude@users.noreply.github.com>

Co-authored-by: Novan Adrian <novan.adrian@qasir.id>

* chore(googlechat): leave changelog to release automation

* style(googlechat): apply canonical formatting

* chore(googlechat): leave changelog to release automation

* style(googlechat): keep monitor imports canonical

* style(googlechat): keep monitor imports canonical

---------

Co-authored-by: Novan Adrian <novan.adrian@qasir.id>
2026-07-11 03:57:16 -07:00

57 lines
1.5 KiB
TypeScript

// Googlechat tests cover monitor durable plugin behavior.
import { describe, expect, it } from "vitest";
import { resolveGoogleChatDurableReplyOptions } from "./monitor-durable.js";
describe("resolveGoogleChatDurableReplyOptions", () => {
it("enables durable final delivery when no typing preview is active", () => {
expect(
resolveGoogleChatDurableReplyOptions({
payload: { text: "hello", replyToId: "thread-1" },
infoKind: "final",
spaceId: "spaces/AAA",
hasTypingMessage: false,
}),
).toEqual({
to: "spaces/AAA",
replyToId: "thread-1",
threadId: "thread-1",
});
});
it("suppresses stale context reply metadata when the final payload is top-level", () => {
expect(
resolveGoogleChatDurableReplyOptions({
payload: { text: "hello" },
infoKind: "final",
spaceId: "spaces/AAA",
hasTypingMessage: false,
}),
).toEqual({
to: "spaces/AAA",
replyToId: null,
});
});
it("keeps typing preview delivery on the legacy edit path", () => {
expect(
resolveGoogleChatDurableReplyOptions({
payload: { text: "hello" },
infoKind: "final",
spaceId: "spaces/AAA",
hasTypingMessage: true,
}),
).toBe(false);
});
it("does not durable-deliver non-final chunks", () => {
expect(
resolveGoogleChatDurableReplyOptions({
payload: { text: "hello" },
infoKind: "block",
spaceId: "spaces/AAA",
hasTypingMessage: false,
}),
).toBe(false);
});
});