From 1f0193b7838c801b3c828736ad6fe00fed78ed6b Mon Sep 17 00:00:00 2001 From: Fusion Date: Thu, 14 May 2026 14:38:51 -0700 Subject: [PATCH] test(FN-4530): align chat manager prompt and room store test fakes Fusion-Task-Id: FN-4530 Fusion-Task-Lineage: f98e68fc-de86-473b-b3a2-bcec95dd74c5 --- .../dashboard/src/__tests__/chat-manager-room-hybrid.test.ts | 2 ++ packages/dashboard/src/__tests__/chat-manager.test.ts | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/dashboard/src/__tests__/chat-manager-room-hybrid.test.ts b/packages/dashboard/src/__tests__/chat-manager-room-hybrid.test.ts index 5eac88b6d..341b88db1 100644 --- a/packages/dashboard/src/__tests__/chat-manager-room-hybrid.test.ts +++ b/packages/dashboard/src/__tests__/chat-manager-room-hybrid.test.ts @@ -5,6 +5,7 @@ const mockChatStore = { listRoomMembers: vi.fn(), createSession: vi.fn(), getRoom: vi.fn(), + getRoomMessages: vi.fn(), addRoomMessage: vi.fn(), }; @@ -18,6 +19,7 @@ describe("ChatManager room hybrid responder resolution", () => { vi.clearAllMocks(); __resetChatState(); mockChatStore.getRoom.mockReturnValue({ id: "room-1", name: "room-1" }); + mockChatStore.getRoomMessages.mockReturnValue([]); mockChatStore.addRoomMessage.mockImplementation((_roomId: string, input: any) => ({ id: `msg-${mockChatStore.addRoomMessage.mock.calls.length}`, roomId: "room-1", diff --git a/packages/dashboard/src/__tests__/chat-manager.test.ts b/packages/dashboard/src/__tests__/chat-manager.test.ts index f30bf2333..80e72fad9 100644 --- a/packages/dashboard/src/__tests__/chat-manager.test.ts +++ b/packages/dashboard/src/__tests__/chat-manager.test.ts @@ -1158,7 +1158,7 @@ describe("ChatManager.sendMessage", () => { expect(mockAgentStore.getAgent).toHaveBeenCalledWith("agent-001"); expect(createOptions.systemPrompt).toContain("Be calm and precise."); expect(createOptions.systemPrompt).toContain("Your chat reply is the primary response to the user."); - expect(createOptions.systemPrompt).toContain("Only use `fn_send_message` when the user explicitly asks"); + expect(createOptions.systemPrompt).toContain("Use `fn_send_message` only when either (a) the user explicitly asks"); }); it("includes guidance to avoid double-sending mailbox copies by default", async () => { @@ -1180,7 +1180,7 @@ describe("ChatManager.sendMessage", () => { await chatManager.sendMessage("chat-001", "Hello"); expect(createOptions.systemPrompt).toContain("Do not also call `fn_send_message` with the same content"); - expect(createOptions.systemPrompt).toContain("Only use `fn_send_message` when the user explicitly asks for mailbox/inbox/notification delivery"); + expect(createOptions.systemPrompt).toContain("Use `fn_send_message` only when either (a) the user explicitly asks for mailbox/inbox/notification delivery"); }); it("passes enriched system prompt with agent memory when agent context is available", async () => {