Skip to content

Commit 68f6226

Browse files
committed
test(webview): remove brittle identifier mutation tests
1 parent 5b1c51a commit 68f6226

2 files changed

Lines changed: 1 addition & 47 deletions

File tree

webview-ui/src/components/ui/hooks/__tests__/useSelectedModel.spec.ts

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import {
2222
vscodeLlmDefaultModelId,
2323
moonshotDefaultModelId,
2424
moonshotModels,
25-
providerIdentifiers,
2625
} from "@roo-code/types"
2726

2827
import { useSelectedModel } from "../useSelectedModel"
@@ -832,28 +831,6 @@ describe("useSelectedModel", () => {
832831
expect(result.current.info).toEqual(openAiModelInfoSaneDefaults)
833832
})
834833

835-
it("uses the canonical OpenAI identifier to select configured model metadata", () => {
836-
const identifiers = providerIdentifiers as Record<string, string>
837-
const originalIdentifier = identifiers.openai
838-
839-
try {
840-
identifiers.openai = "canonical-openai"
841-
842-
const apiConfiguration = {
843-
apiProvider: identifiers.openai,
844-
openAiModelId: "gpt-4o",
845-
} as ProviderSettings
846-
847-
const wrapper = createWrapper()
848-
const { result } = renderHook(() => useSelectedModel(apiConfiguration), { wrapper })
849-
850-
expect(result.current.id).toBe("gpt-4o")
851-
expect(result.current.info).toEqual(openAiModelInfoSaneDefaults)
852-
} finally {
853-
identifiers.openai = originalIdentifier
854-
}
855-
})
856-
857834
it("should return custom model info when provided", () => {
858835
const customModelInfo: ModelInfo = {
859836
maxTokens: 16384,

webview-ui/src/utils/__tests__/validate.spec.ts

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
import {
2-
providerIdentifiers,
3-
type ProviderSettings,
4-
type OrganizationAllowList,
5-
type RouterModels,
6-
} from "@roo-code/types"
1+
import { type ProviderSettings, type OrganizationAllowList, type RouterModels } from "@roo-code/types"
72

83
// Mock i18next to return translation keys with interpolated values
94
vi.mock("i18next", () => ({
@@ -141,24 +136,6 @@ describe("Model Validation Functions", () => {
141136
})
142137

143138
describe("validateApiConfigurationExcludingModelErrors", () => {
144-
it("uses the canonical OpenRouter identifier for credential validation", () => {
145-
const identifiers = providerIdentifiers as Record<string, string>
146-
const originalIdentifier = identifiers.openrouter
147-
148-
try {
149-
identifiers.openrouter = "canonical-openrouter"
150-
151-
const config = {
152-
apiProvider: identifiers.openrouter,
153-
openRouterModelId: "valid-model",
154-
} as ProviderSettings
155-
156-
expect(validateApiConfigurationExcludingModelErrors(config)).toBe("settings:validation.apiKey")
157-
} finally {
158-
identifiers.openrouter = originalIdentifier
159-
}
160-
})
161-
162139
it("returns undefined when configuration is valid", () => {
163140
const config: ProviderSettings = {
164141
apiProvider: "openrouter",

0 commit comments

Comments
 (0)