mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-21 02:55:16 +00:00
test: guard embedded subscribe mock calls
This commit is contained in:
parent
16adcc75b0
commit
ee40b9bbbd
5 changed files with 5 additions and 5 deletions
|
|
@ -438,7 +438,7 @@ describe("streamWithIdleTimeout", () => {
|
|||
expect(error).toBeInstanceOf(Error);
|
||||
expect((error as Error).message).toMatch(/LLM idle timeout/);
|
||||
expect(onIdleTimeout).toHaveBeenCalledTimes(1);
|
||||
const [timeoutError] = onIdleTimeout.mock.calls[0] ?? [];
|
||||
const [timeoutError] = onIdleTimeout.mock.calls.at(0) ?? [];
|
||||
expect(timeoutError).toBeInstanceOf(Error);
|
||||
expect((timeoutError as Error).message).toMatch(/LLM idle timeout/);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -179,7 +179,7 @@ describe("handleToolExecutionStart read path checks", () => {
|
|||
await handleToolExecutionStart(ctx, evt);
|
||||
|
||||
expect(warn).toHaveBeenCalledTimes(1);
|
||||
expect(String(warn.mock.calls[0]?.[0] ?? "")).toContain("read tool called without path");
|
||||
expect(String(warn.mock.calls.at(0)?.[0] ?? "")).toContain("read tool called without path");
|
||||
});
|
||||
|
||||
it("awaits onBlockReplyFlush before continuing tool start processing", async () => {
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ describe("subscribeEmbeddedPiSession", () => {
|
|||
await Promise.resolve();
|
||||
|
||||
expect(onToolResult).toHaveBeenCalledTimes(1);
|
||||
const payload = onToolResult.mock.calls[0][0];
|
||||
const payload = onToolResult.mock.calls.at(0)?.[0];
|
||||
expect(payload.text).toContain("🖼️");
|
||||
expect(payload.text).toContain("Canvas");
|
||||
expect(payload.text).toContain("/tmp/a2ui.jsonl");
|
||||
|
|
|
|||
|
|
@ -34,6 +34,6 @@ describe("subscribeEmbeddedPiSession", () => {
|
|||
emitAssistantTextDeltaAndEnd({ emit, text });
|
||||
|
||||
expect(onBlockReply).toHaveBeenCalledTimes(3);
|
||||
expect(onBlockReply.mock.calls[1][0].text).toBe("~~~sh\nline1\nline2\n~~~");
|
||||
expect(onBlockReply.mock.calls.at(1)?.[0].text).toBe("~~~sh\nline1\nline2\n~~~");
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -249,7 +249,7 @@ describe("subscribeEmbeddedPiSession", () => {
|
|||
await flushBlockReplyCallbacks();
|
||||
|
||||
expect(onBlockReply).toHaveBeenCalledTimes(1);
|
||||
expect(onBlockReply.mock.calls[0][0].text).toBe("Final answer");
|
||||
expect(onBlockReply.mock.calls.at(0)?.[0].text).toBe("Final answer");
|
||||
|
||||
const streamTexts = onReasoningStream.mock.calls
|
||||
.map((call) => call[0]?.text)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue