diff --git a/src/agents/subagent-control.test.ts b/src/agents/subagent-control.test.ts index 95234534c97..0daba9a8dea 100644 --- a/src/agents/subagent-control.test.ts +++ b/src/agents/subagent-control.test.ts @@ -262,11 +262,9 @@ describe("sendControlledSubagentMessage", () => { message: "continue", }); - expect(result).toEqual({ - status: "error", - runId: expect.any(String), - error: "gateway unavailable", - }); + expect(result.status).toBe("error"); + expect(typeof result.runId).toBe("string"); + expect(result.error).toBe("gateway unavailable"); }); it("does not send to a newer live run when the caller passes a stale run entry", async () => { @@ -557,12 +555,10 @@ describe("killSubagentRunAdmin", () => { sessionKey: childSessionKey, }); - expect(result).toMatchObject({ - found: true, - killed: true, - runId: "run-worker", - sessionKey: childSessionKey, - }); + expect(result.found).toBe(true); + expect(result.killed).toBe(true); + expect(result.runId).toBe("run-worker"); + expect(result.sessionKey).toBe(childSessionKey); expect(getSubagentRunByChildSessionKey(childSessionKey)?.endedAt).toBeTypeOf("number"); }); @@ -608,12 +604,10 @@ describe("killSubagentRunAdmin", () => { sessionKey: childSessionKey, }); - expect(result).toMatchObject({ - found: true, - killed: false, - runId: "run-current-admin", - sessionKey: childSessionKey, - }); + expect(result.found).toBe(true); + expect(result.killed).toBe(false); + expect(result.runId).toBe("run-current-admin"); + expect(result.sessionKey).toBe(childSessionKey); }); it("still terminates the run when session store persistence fails during kill", async () => { @@ -648,12 +642,10 @@ describe("killSubagentRunAdmin", () => { sessionKey: childSessionKey, }); - expect(result).toMatchObject({ - found: true, - killed: true, - runId: "run-worker-store-fail", - sessionKey: childSessionKey, - }); + expect(result.found).toBe(true); + expect(result.killed).toBe(true); + expect(result.runId).toBe("run-worker-store-fail"); + expect(result.sessionKey).toBe(childSessionKey); expect(getSubagentRunByChildSessionKey(childSessionKey)?.endedAt).toBeTypeOf("number"); }); }); @@ -1232,10 +1224,9 @@ describe("steerControlledSubagentRun", () => { sessionId: undefined, error: "failed to replace steered subagent run", }); - expect(getSubagentRunByChildSessionKey("agent:main:subagent:steer-worker")).toMatchObject({ - runId: "run-steer-old", - suppressAnnounceReason: undefined, - }); + const storedRun = getSubagentRunByChildSessionKey("agent:main:subagent:steer-worker"); + expect(storedRun?.runId).toBe("run-steer-old"); + expect(storedRun?.suppressAnnounceReason).toBeUndefined(); } finally { replaceSpy.mockRestore(); }