test(agent-events): use toMatchObject for context assertions

The new registeredAt and lastActiveAt fields on AgentRunContext cause
toEqual to fail because it expects exact property counts. Switch to
toMatchObject which validates expected properties without requiring
exact match — the standard pattern for objects with auto-injected
timestamps.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
XING
2026-03-23 18:11:32 +08:00
committed by Josh Lehman
parent 8edb92042b
commit e62d0b3d31

View File

@@ -107,7 +107,7 @@ describe("agent-events sequencing", () => {
isHeartbeat: true,
});
expect(getAgentRunContext("run-ctx")).toEqual({
expect(getAgentRunContext("run-ctx")).toMatchObject({
sessionKey: "session-main",
verboseLevel: "full",
isHeartbeat: true,
@@ -186,7 +186,7 @@ describe("agent-events sequencing", () => {
stop();
expect(second.getAgentRunContext("run-dup")).toEqual({ sessionKey: "session-dup" });
expect(second.getAgentRunContext("run-dup")).toMatchObject({ sessionKey: "session-dup" });
expect(seen).toEqual([
{ seq: 1, sessionKey: "session-dup" },
{ seq: 2, sessionKey: "session-dup" },