|
|
@@ -1,7 +1,6 @@
|
|
|
-import React from "react"
|
|
|
import { render, screen, fireEvent } from "@testing-library/react"
|
|
|
import { ThinkingBudget } from "../ThinkingBudget"
|
|
|
-import { ApiProvider, ModelInfo } from "../../../../../src/shared/api"
|
|
|
+import { ModelInfo } from "../../../../../src/shared/api"
|
|
|
|
|
|
// Mock Slider component
|
|
|
jest.mock("@/components/ui", () => ({
|
|
|
@@ -25,11 +24,11 @@ describe("ThinkingBudget", () => {
|
|
|
supportsPromptCache: true,
|
|
|
supportsImages: true,
|
|
|
}
|
|
|
+
|
|
|
const defaultProps = {
|
|
|
apiConfiguration: {},
|
|
|
setApiConfigurationField: jest.fn(),
|
|
|
modelInfo: mockModelInfo,
|
|
|
- provider: "anthropic" as ApiProvider,
|
|
|
}
|
|
|
|
|
|
beforeEach(() => {
|
|
|
@@ -60,25 +59,7 @@ describe("ThinkingBudget", () => {
|
|
|
expect(screen.getAllByTestId("slider")).toHaveLength(2)
|
|
|
})
|
|
|
|
|
|
- it("should use modelMaxThinkingTokens field for Anthropic provider", () => {
|
|
|
- const setApiConfigurationField = jest.fn()
|
|
|
-
|
|
|
- render(
|
|
|
- <ThinkingBudget
|
|
|
- {...defaultProps}
|
|
|
- apiConfiguration={{ modelMaxThinkingTokens: 4096 }}
|
|
|
- setApiConfigurationField={setApiConfigurationField}
|
|
|
- provider="anthropic"
|
|
|
- />,
|
|
|
- )
|
|
|
-
|
|
|
- const sliders = screen.getAllByTestId("slider")
|
|
|
- fireEvent.change(sliders[1], { target: { value: "5000" } })
|
|
|
-
|
|
|
- expect(setApiConfigurationField).toHaveBeenCalledWith("modelMaxThinkingTokens", 5000)
|
|
|
- })
|
|
|
-
|
|
|
- it("should use modelMaxThinkingTokens field for Vertex provider", () => {
|
|
|
+ it("should update modelMaxThinkingTokens", () => {
|
|
|
const setApiConfigurationField = jest.fn()
|
|
|
|
|
|
render(
|
|
|
@@ -86,7 +67,6 @@ describe("ThinkingBudget", () => {
|
|
|
{...defaultProps}
|
|
|
apiConfiguration={{ modelMaxThinkingTokens: 4096 }}
|
|
|
setApiConfigurationField={setApiConfigurationField}
|
|
|
- provider="vertex"
|
|
|
/>,
|
|
|
)
|
|
|
|