mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-14 09:10:48 +00:00
test: tighten process send-key assertions
This commit is contained in:
@@ -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");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user