diff --git a/src/infra/outbound/agent-delivery.test.ts b/src/infra/outbound/agent-delivery.test.ts index 0cf6eb663a9..dd8d6b63762 100644 --- a/src/infra/outbound/agent-delivery.test.ts +++ b/src/infra/outbound/agent-delivery.test.ts @@ -167,7 +167,9 @@ describe("agent delivery helpers", () => { }, ])("builds delivery plan for %j", ({ params, expected }) => { const plan = expectDeliveryPlan(params); - expect(plan).toMatchObject(expected); + for (const [key, value] of Object.entries(expected)) { + expect((plan as Record)[key]).toEqual(value); + } }); it("resolves fallback targets when no explicit destination is provided", () => { diff --git a/src/infra/outbound/bound-delivery-router.test.ts b/src/infra/outbound/bound-delivery-router.test.ts index accd5edd366..f8e3a3cf7c9 100644 --- a/src/infra/outbound/bound-delivery-router.test.ts +++ b/src/infra/outbound/bound-delivery-router.test.ts @@ -188,7 +188,9 @@ describe("bound delivery router", () => { failClosed, }); - expect(route).toMatchObject(expected); + for (const [key, value] of Object.entries(expected)) { + expect((route as Record)[key]).toEqual(value); + } if (expectedConversationId !== undefined) { expect(route.binding?.conversation.conversationId).toBe(expectedConversationId); } diff --git a/src/infra/outbound/outbound-session.test.ts b/src/infra/outbound/outbound-session.test.ts index dc98eaab280..38210f58c32 100644 --- a/src/infra/outbound/outbound-session.test.ts +++ b/src/infra/outbound/outbound-session.test.ts @@ -3,8 +3,13 @@ import type { OpenClawConfig } from "../../config/config.js"; import { ensureOutboundSessionEntry, resolveOutboundSessionRoute } from "./outbound-session.js"; import { setMinimalOutboundSessionPluginRegistryForTests } from "./outbound-session.test-helpers.js"; +type InboundMetadataParams = { + sessionKey?: string; + storePath?: string; +}; + const mocks = vi.hoisted(() => ({ - recordSessionMetaFromInbound: vi.fn(async () => ({ ok: true })), + recordSessionMetaFromInbound: vi.fn(async (_params: InboundMetadataParams) => ({ ok: true })), resolveStorePath: vi.fn( (_store: unknown, params?: { agentId?: string }) => `/stores/${params?.agentId ?? "main"}.json`, ), @@ -394,7 +399,9 @@ describe("resolveOutboundSessionRoute", () => { resolvedTarget, }); - expect(route).toMatchObject(expected); + for (const [key, value] of Object.entries(expected)) { + expect((route as Record)[key]).toEqual(value); + } }); it("rejects bare numeric GuildChat targets when the caller has no kind hint", async () => { @@ -436,11 +443,9 @@ describe("ensureOutboundSessionEntry", () => { expect(mocks.resolveStorePath).toHaveBeenCalledWith("/stores/{agentId}.json", { agentId: "main", }); - expect(mocks.recordSessionMetaFromInbound).toHaveBeenCalledWith( - expect.objectContaining({ - storePath: "/stores/main.json", - sessionKey: "agent:main:workspace:channel:c1", - }), - ); + expect(mocks.recordSessionMetaFromInbound).toHaveBeenCalledOnce(); + const metadata = mocks.recordSessionMetaFromInbound.mock.calls[0]?.[0]; + expect(metadata?.storePath).toBe("/stores/main.json"); + expect(metadata?.sessionKey).toBe("agent:main:workspace:channel:c1"); }); });