From 93875ae5fc440221219e5240b3b423aed9679c48 Mon Sep 17 00:00:00 2001 From: Roo Code Date: Tue, 30 Dec 2025 02:42:48 +0000 Subject: [PATCH] test(openai): add test coverage for openAiDisableNativeTools setting --- src/api/providers/__tests__/openai.spec.ts | 50 ++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/src/api/providers/__tests__/openai.spec.ts b/src/api/providers/__tests__/openai.spec.ts index 4469efd4d1..3f8fc8b2bd 100644 --- a/src/api/providers/__tests__/openai.spec.ts +++ b/src/api/providers/__tests__/openai.spec.ts @@ -585,6 +585,56 @@ describe("OpenAiHandler", () => { expect(model.id).toBe("") expect(model.info).toBeDefined() }) + + it("should default to supportsNativeTools true for standard models", () => { + const model = handler.getModel() + expect(model.info.supportsNativeTools).toBe(true) + }) + + it("should disable native tools when openAiDisableNativeTools is true", () => { + const handlerWithDisabledTools = new OpenAiHandler({ + ...mockOptions, + openAiDisableNativeTools: true, + }) + const model = handlerWithDisabledTools.getModel() + expect(model.info.supportsNativeTools).toBe(false) + }) + + it("should disable native tools for deepseek-r1 model", () => { + const handlerWithDeepSeekR1 = new OpenAiHandler({ + ...mockOptions, + openAiModelId: "deepseek-r1", + }) + const model = handlerWithDeepSeekR1.getModel() + expect(model.info.supportsNativeTools).toBe(false) + }) + + it("should disable native tools for deepseek-reasoner model", () => { + const handlerWithDeepSeekReasoner = new OpenAiHandler({ + ...mockOptions, + openAiModelId: "deepseek-reasoner", + }) + const model = handlerWithDeepSeekReasoner.getModel() + expect(model.info.supportsNativeTools).toBe(false) + }) + + it("should disable native tools when openAiR1FormatEnabled is true", () => { + const handlerWithR1Format = new OpenAiHandler({ + ...mockOptions, + openAiR1FormatEnabled: true, + }) + const model = handlerWithR1Format.getModel() + expect(model.info.supportsNativeTools).toBe(false) + }) + + it("should disable native tools for deepseek-r1 variants (e.g., deepseek-r1-distill-qwen-32b)", () => { + const handlerWithDeepSeekR1Variant = new OpenAiHandler({ + ...mockOptions, + openAiModelId: "deepseek-r1-distill-qwen-32b", + }) + const model = handlerWithDeepSeekR1Variant.getModel() + expect(model.info.supportsNativeTools).toBe(false) + }) }) describe("Azure AI Inference Service", () => {