diff --git a/src/agents/bash-tools.process-send-keys.test.ts b/src/agents/bash-tools.process-send-keys.test.ts index 72cff95952f..90b8e22cab1 100644 --- a/src/agents/bash-tools.process-send-keys.test.ts +++ b/src/agents/bash-tools.process-send-keys.test.ts @@ -12,6 +12,12 @@ function createWritableStdinStub(): WritableStdin { }; } +function expectTextContent(content: unknown, text: string) { + const part = content as { type?: string; text?: string } | undefined; + expect(part?.type).toBe("text"); + expect(part?.text).toContain(text); +} + test("process send-keys fails loud for unknown cursor mode when arrows depend on it", async () => { const result = await handleProcessSendKeys({ sessionId: "sess-unknown-mode", @@ -25,11 +31,8 @@ test("process send-keys fails loud for unknown cursor mode when arrows depend on keys: ["up"], }); - expect(result.details).toMatchObject({ status: "failed" }); - expect(result.content[0]).toMatchObject({ - type: "text", - text: expect.stringContaining("cursor key mode is not known yet"), - }); + expect((result.details as { status?: string }).status).toBe("failed"); + expectTextContent(result.content[0], "cursor key mode is not known yet"); }); test("process send-keys still sends non-cursor keys while mode is unknown", async () => { @@ -45,5 +48,5 @@ test("process send-keys still sends non-cursor keys while mode is unknown", asyn keys: ["Enter"], }); - expect(result.details).toMatchObject({ status: "running" }); + expect((result.details as { status?: string }).status).toBe("running"); });