Skip to content

Commit 4068d2c

Browse files
committed
test(e2e): use canonical provider identifiers and drop unnecessary fetch casts
- use providerIdentifiers.openrouter / providerIdentifiers.lmstudio per zoo/no-raw-provider-identifiers (shared rule added on main in #1421) - drop (input as Request), 'init as RequestInit' and 'as typeof globalThis.fetch': the suite type-checks without them under both e2e tsconfigs
1 parent 6226cd6 commit 4068d2c

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

‎apps/vscode-e2e/src/suite/providers/lmstudio.test.ts‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as assert from "assert"
22

3-
import { RooCodeEventName, type ClineMessage } from "@roo-code/types"
3+
import { RooCodeEventName, providerIdentifiers, type ClineMessage } from "@roo-code/types"
44

55
import { setDefaultSuiteTimeout } from "../test-utils"
66
import { waitUntilCompleted } from "../utils"
@@ -25,7 +25,7 @@ type CapturedLmStudioRequest = {
2525

2626
/** Returns the URL string for a fetch request input (string, URL, or Request). */
2727
function getRequestUrl(input: RequestInfo | URL): string {
28-
return typeof input === "string" ? input : input instanceof URL ? input.href : (input as Request).url
28+
return typeof input === "string" ? input : input instanceof URL ? input.href : input.url
2929
}
3030

3131
/** True if the raw URL parses and its origin equals the expected origin. */
@@ -68,8 +68,8 @@ function installLmStudioRequestCapture(capture: CapturedLmStudioRequest[], baseU
6868
capture.push({ model: body.model, lastUserMessage })
6969
}
7070

71-
return originalFetch.call(globalThis, input, init as RequestInit)
72-
} as typeof globalThis.fetch
71+
return originalFetch.call(globalThis, input, init)
72+
}
7373

7474
return () => {
7575
globalThis.fetch = originalFetch
@@ -121,7 +121,7 @@ suite("LM Studio provider", function () {
121121
// Explicitly clear the LM Studio fields: setConfiguration only updates
122122
// supplied keys, so omitting them would leave them set for later suites.
123123
await globalThis.api.setConfiguration({
124-
apiProvider: "openrouter" as const,
124+
apiProvider: providerIdentifiers.openrouter,
125125
lmStudioBaseUrl: undefined,
126126
lmStudioModelId: undefined,
127127
openRouterApiKey: "mock-key",
@@ -140,7 +140,7 @@ suite("LM Studio provider", function () {
140140

141141
// LmStudioHandler appends /v1 itself, so the base URL is aimock's origin only.
142142
await api.setConfiguration({
143-
apiProvider: "lmstudio" as const,
143+
apiProvider: providerIdentifiers.lmstudio,
144144
lmStudioBaseUrl: aimockUrl,
145145
lmStudioModelId: LMSTUDIO_MODEL_ID,
146146
})

0 commit comments

Comments
 (0)