mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-18 12:14:46 +00:00
test: guard realtime talk consult mock call
This commit is contained in:
@@ -3,6 +3,14 @@
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
import { submitRealtimeTalkConsult } from "./chat/realtime-talk-shared.js";
|
||||
|
||||
function requireFirstMockCall(calls: readonly unknown[][], label: string): unknown[] {
|
||||
const call = calls.at(0);
|
||||
if (!call) {
|
||||
throw new Error(`expected ${label} call`);
|
||||
}
|
||||
return call;
|
||||
}
|
||||
|
||||
describe("RealtimeTalkSession consult handoff", () => {
|
||||
it("submits realtime consults through the Gateway tool-call endpoint", async () => {
|
||||
let listener: ((event: { event: string; payload?: unknown }) => void) | undefined;
|
||||
@@ -41,7 +49,7 @@ describe("RealtimeTalkSession consult handoff", () => {
|
||||
submit,
|
||||
});
|
||||
|
||||
const toolCall = request.mock.calls[0] as
|
||||
const toolCall = requireFirstMockCall(request.mock.calls, "Gateway request") as
|
||||
| [string, { sessionKey?: string; name?: string; args?: { question?: string } }]
|
||||
| undefined;
|
||||
expect(toolCall?.[0]).toBe("talk.client.toolCall");
|
||||
|
||||
Reference in New Issue
Block a user