

























@@ -280,18 +280,31 @@ describe("broadcast dispatch", () => {
280280expect(sessionKeys).toContain("agent:susan:feishu:group:oc-broadcast-group");
281281expect(sessionKeys).toContain("agent:main:feishu:group:oc-broadcast-group");
282282expect(mockGetChatInfo).toHaveBeenCalledTimes(1);
283-expect(finalizeInboundContextCalls).toEqual(
284-expect.arrayContaining([
285-expect.objectContaining({
286-GroupSubject: "Broadcast Team",
287-ConversationLabel: "Broadcast Team",
288-}),
289-]),
290-);
283+expect(
284+finalizeInboundContextCalls
285+.map((call) => ({
286+sessionKey: call.SessionKey,
287+groupSubject: call.GroupSubject,
288+conversationLabel: call.ConversationLabel,
289+}))
290+.sort((left, right) => String(left.sessionKey).localeCompare(String(right.sessionKey))),
291+).toEqual([
292+{
293+sessionKey: "agent:main:feishu:group:oc-broadcast-group",
294+groupSubject: "Broadcast Team",
295+conversationLabel: "Broadcast Team",
296+},
297+{
298+sessionKey: "agent:susan:feishu:group:oc-broadcast-group",
299+groupSubject: "Broadcast Team",
300+conversationLabel: "Broadcast Team",
301+},
302+]);
291303expect(mockCreateFeishuReplyDispatcher).toHaveBeenCalledTimes(1);
292-expect(mockCreateFeishuReplyDispatcher).toHaveBeenCalledWith(
293-expect.objectContaining({ agentId: "main" }),
294-);
304+const dispatcherParams = mockCreateFeishuReplyDispatcher.mock.calls[0]?.[0] as
305+| { agentId?: string }
306+| undefined;
307+expect(dispatcherParams?.agentId).toBe("main");
295308});
296309297310it("skips broadcast dispatch when bot is NOT mentioned (requireMention=true)", async () => {
@@ -365,13 +378,12 @@ describe("broadcast dispatch", () => {
365378366379expect(mockDispatchReplyFromConfig).toHaveBeenCalledTimes(1);
367380expect(mockCreateFeishuReplyDispatcher).toHaveBeenCalledTimes(1);
368-expect(finalizeInboundContextCalls).toContainEqual(
369-expect.objectContaining({
370-SessionKey: "agent:main:feishu:group:oc-broadcast-group",
371-GroupSubject: "Broadcast Team",
372-ConversationLabel: "Broadcast Team",
373-}),
381+expect(finalizeInboundContextCalls).toHaveLength(1);
382+expect(finalizeInboundContextCalls[0]?.SessionKey).toBe(
383+"agent:main:feishu:group:oc-broadcast-group",
374384);
385+expect(finalizeInboundContextCalls[0]?.GroupSubject).toBe("Broadcast Team");
386+expect(finalizeInboundContextCalls[0]?.ConversationLabel).toBe("Broadcast Team");
375387expect(mockGetChatInfo).toHaveBeenCalledTimes(1);
376388});
377389此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。