test: fix websocket tool shape coverage

This commit is contained in:
Peter Steinberger
2026-03-12 02:16:44 +00:00
parent 487a3ba8ce
commit 17fd46ab66
2 changed files with 4 additions and 6 deletions

View File

@@ -595,14 +595,12 @@ describe("OpenAIWebSocketManager", () => {
manager.warmUp({
model: "gpt-5.2",
tools: [{ type: "function", function: { name: "exec", description: "Run a command" } }],
tools: [{ type: "function", name: "exec", description: "Run a command" }],
});
const sent = JSON.parse(sock.sentMessages[0] ?? "{}") as Record<string, unknown>;
expect(sent["tools"]).toHaveLength(1);
expect((sent["tools"] as Array<{ function?: { name?: string } }>)[0]?.function?.name).toBe(
"exec",
);
expect((sent["tools"] as Array<{ name?: string }>)[0]?.name).toBe("exec");
});
});

View File

@@ -164,7 +164,7 @@ describe("OpenAI WebSocket e2e", () => {
transport: "websocket",
toolChoice: "required",
maxTokens: 128,
}),
} as unknown as StreamFnParams[2]),
);
const firstDone = expectDone(firstEvents);
const toolCall = firstDone.content.find((block) => block.type === "toolCall") as
@@ -206,7 +206,7 @@ describe("OpenAI WebSocket e2e", () => {
transport: "websocket",
openaiWsWarmup: true,
maxTokens: 32,
}),
} as unknown as StreamFnParams[2]),
),
);