


























@@ -113,13 +113,15 @@ describe("mattermost mention gating", () => {
113113const { resolver, decision } = evaluateMentionGateForMessage({ cfg });
114114expect(decision.dropReason).toBeNull();
115115expect(decision.shouldRequireMention).toBe(false);
116-expect(resolver).toHaveBeenCalledWith(
117-expect.objectContaining({
118-accountId: "default",
119-groupId: "chan-1",
120-requireMentionOverride: false,
121-}),
122-);
116+expect(resolver).toHaveBeenCalledTimes(1);
117+const [resolverCall] = resolver.mock.calls[0] ?? [];
118+expect(resolverCall).toStrictEqual({
119+ cfg,
120+channel: "mattermost",
121+accountId: "default",
122+groupId: "chan-1",
123+requireMentionOverride: false,
124+});
123125});
124126125127it("accepts unmentioned thread replies in onmessage mode", () => {
@@ -475,12 +477,13 @@ describe("deliverMattermostReplyWithDraftPreview", () => {
475477it("finalizes the preview in place when the final targets the same thread", async () => {
476478const draftStream = createDraftStreamMock();
477479const deliverFinal = vi.fn(async () => {});
480+const client = createMattermostClientMock();
478481479482await deliverMattermostReplyWithDraftPreview({
480483payload: { text: "Final answer", replyToId: "child-post-789" } as never,
481484info: { kind: "final" },
482485kind: "channel",
483-client: createMattermostClientMock(),
486+ client,
484487 draftStream,
485488effectiveReplyToId: "thread-root-456",
486489resolvePreviewFinalText: (text) => text?.trim(),
@@ -489,11 +492,11 @@ describe("deliverMattermostReplyWithDraftPreview", () => {
489492 deliverFinal,
490493});
491494492-expect(updateMattermostPostSpy).toHaveBeenCalledWith(
493- expect.anything(),
494- "preview-post-1",
495- expect.objectContaining({ message: "Final answer" }),
496-);
495+expect(updateMattermostPostSpy).toHaveBeenCalledTimes(1);
496+const [updateClient, updatePostId, updateParams] = updateMattermostPostSpy.mock.calls[0] ?? [];
497+expect(updateClient).toBe(client);
498+expect(updatePostId).toBe("preview-post-1");
499+expect(updateParams).toStrictEqual({ message: "Final answer" });
497500expect(draftStream.flush).toHaveBeenCalledTimes(1);
498501expect(draftStream.seal).toHaveBeenCalledTimes(1);
499502expect(draftStream.seal.mock.invocationCallOrder[0]).toBeLessThan(
@@ -525,11 +528,7 @@ describe("deliverMattermostReplyWithDraftPreview", () => {
525528526529expect(draftStream.discardPending).toHaveBeenCalledTimes(1);
527530expect(draftStream.clear).not.toHaveBeenCalled();
528-expect(updateMattermostPostSpy).not.toHaveBeenCalledWith(
529-expect.anything(),
530-"preview-post-1",
531-expect.objectContaining({ message: "↓ See below." }),
532-);
531+expect(updateMattermostPostSpy).not.toHaveBeenCalled();
533532});
534533});
535534此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。