Skip to content

Commit 4ca1971

Browse files
committed
test(openai-native): cover omitted completion tiers
1 parent c64bf5f commit 4ca1971

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

src/api/providers/__tests__/openai-native.spec.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,31 @@ describe("OpenAiNativeHandler", () => {
266266
},
267267
)
268268

269+
it("should omit the service tier when none is configured", async () => {
270+
mockResponsesCreate.mockResolvedValue({ output: [] })
271+
272+
await handler.completePrompt("Test prompt")
273+
274+
const [request] = mockResponsesCreate.mock.calls[0]
275+
expect(request.stream).toBe(false)
276+
expect(request).not.toHaveProperty(SERVICE_TIER_KEY)
277+
})
278+
279+
it("should omit a configured service tier that the model does not support", async () => {
280+
mockResponsesCreate.mockResolvedValue({ output: [] })
281+
handler = new OpenAiNativeHandler({
282+
...mockOptions,
283+
apiModelId: "gpt-5.6-luna",
284+
openAiNativeServiceTier: OpenAiServiceTier.Priority,
285+
})
286+
287+
await handler.completePrompt("Test prompt")
288+
289+
const [request] = mockResponsesCreate.mock.calls[0]
290+
expect(request.stream).toBe(false)
291+
expect(request).not.toHaveProperty(SERVICE_TIER_KEY)
292+
})
293+
269294
it("should handle SDK errors in completePrompt", async () => {
270295
// Mock SDK to throw an error
271296
mockResponsesCreate.mockRejectedValue(new Error("API Error"))

0 commit comments

Comments
 (0)