Skip to content

Commit 5a6f256

Browse files
committed
fix: correct gemini abort signal test to match config.abortSignal path
1 parent 768b42c commit 5a6f256

1 file changed

Lines changed: 11 additions & 9 deletions

File tree

src/api/providers/__tests__/gemini-abort-signal.spec.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -95,18 +95,20 @@ describe("GeminiHandler abort signal", () => {
9595
})
9696

9797
describe("completePrompt", () => {
98-
it("should pass abort signal through to client via httpOptions", async () => {
98+
it("should pass abort signal through to client via config.abortSignal", async () => {
9999
const controller = new AbortController()
100100
;(handler["client"].models.generateContent as any).mockResolvedValue({ text: "response" })
101101
await handler.completePrompt("test prompt", { abortSignal: controller.signal })
102-
expect(handler["client"].models.generateContent).toHaveBeenCalledWith({
103-
model: GEMINI_MODEL_NAME,
104-
contents: [{ role: "user", parts: [{ text: "test prompt" }] }],
105-
config: {
106-
httpOptions: { signal: controller.signal },
107-
temperature: 1,
108-
},
109-
})
102+
expect(handler["client"].models.generateContent).toHaveBeenCalledWith(
103+
expect.objectContaining({
104+
model: GEMINI_MODEL_NAME,
105+
contents: [{ role: "user", parts: [{ text: "test prompt" }] }],
106+
config: expect.objectContaining({
107+
abortSignal: controller.signal,
108+
temperature: 1,
109+
}),
110+
}),
111+
)
110112
})
111113

112114
it("should work without options (backward compatible)", async () => {

0 commit comments

Comments
 (0)