Skip to content

Commit f03609d

Browse files
committed
More test fixes
1 parent 9555fb8 commit f03609d

File tree

14 files changed

+22
-48
lines changed

14 files changed

+22
-48
lines changed

.eslintrc.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
}
1616
],
1717
"@typescript-eslint/semi": "off",
18+
"no-unused-vars": "off",
19+
"@typescript-eslint/no-unused-vars": ["error", { "varsIgnorePattern": "^_", "argsIgnorePattern": "^_" }],
1820
"eqeqeq": "warn",
1921
"no-throw-literal": "warn",
2022
"semi": "off"

e2e/src/suite/utils.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import * as vscode from "vscode"
2-
31
import type { RooCodeAPI } from "../../../src/exports/roo-code"
42

53
type WaitForOptions = {

src/__mocks__/McpHub.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ export class McpHub {
77
this.callTool = jest.fn()
88
}
99

10-
async toggleToolAlwaysAllow(serverName: string, toolName: string, shouldAllow: boolean): Promise<void> {
10+
async toggleToolAlwaysAllow(_serverName: string, _toolName: string, _shouldAllow: boolean): Promise<void> {
1111
return Promise.resolve()
1212
}
1313

14-
async callTool(serverName: string, toolName: string, toolArguments?: Record<string, unknown>): Promise<any> {
14+
async callTool(_serverName: string, _toolName: string, _toolArguments?: Record<string, unknown>): Promise<any> {
1515
return Promise.resolve({ result: "success" })
1616
}
1717
}

src/__tests__/migrateSettings.test.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ jest.mock("vscode")
1010
jest.mock("fs/promises")
1111
jest.mock("fs")
1212
jest.mock("../utils/fs")
13-
// We're testing the real migrateSettings function
1413

1514
describe("Settings Migration", () => {
1615
let mockContext: vscode.ExtensionContext
@@ -52,8 +51,6 @@ describe("Settings Migration", () => {
5251
})
5352

5453
it("should migrate custom modes file if old file exists and new file doesn't", async () => {
55-
const mockCustomModesContent = '{"customModes":[{"slug":"test-mode"}]}' as string
56-
5754
// Mock file existence checks
5855
;(fileExistsAtPath as jest.Mock).mockImplementation(async (path: string) => {
5956
if (path === mockSettingsDir) return true
@@ -69,8 +66,6 @@ describe("Settings Migration", () => {
6966
})
7067

7168
it("should migrate MCP settings file if old file exists and new file doesn't", async () => {
72-
const mockMcpSettingsContent = '{"mcpServers":{"test-server":{}}}' as string
73-
7469
// Mock file existence checks
7570
;(fileExistsAtPath as jest.Mock).mockImplementation(async (path: string) => {
7671
if (path === mockSettingsDir) return true

src/activate/registerCodeActions.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import * as vscode from "vscode"
33
import { ACTION_NAMES, COMMAND_IDS } from "../core/CodeActionProvider"
44
import { EditorUtils } from "../core/EditorUtils"
55
import { ClineProvider } from "../core/webview/ClineProvider"
6-
import { telemetryService } from "../services/telemetry/TelemetryService"
76

87
export const registerCodeActions = (context: vscode.ExtensionContext) => {
98
registerCodeActionPair(

src/activate/registerCommands.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export type RegisterCommandOptions = {
5454
}
5555

5656
export const registerCommands = (options: RegisterCommandOptions) => {
57-
const { context, outputChannel } = options
57+
const { context } = options
5858

5959
for (const [command, callback] of Object.entries(getCommandsMap(options))) {
6060
context.subscriptions.push(vscode.commands.registerCommand(command, callback))

src/api/providers/__tests__/openrouter.test.ts

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,22 @@
11
// npx jest src/api/providers/__tests__/openrouter.test.ts
22

3-
import axios from "axios"
43
import { Anthropic } from "@anthropic-ai/sdk"
54
import OpenAI from "openai"
65

76
import { OpenRouterHandler } from "../openrouter"
8-
import { ApiHandlerOptions, ModelInfo } from "../../../shared/api"
7+
import { ApiHandlerOptions } from "../../../shared/api"
98

109
// Mock dependencies
1110
jest.mock("openai")
12-
jest.mock("axios")
1311
jest.mock("delay", () => jest.fn(() => Promise.resolve()))
1412

15-
const mockOpenRouterModelInfo: ModelInfo = {
16-
maxTokens: 1000,
17-
contextWindow: 2000,
18-
supportsPromptCache: false,
19-
inputPrice: 0.01,
20-
outputPrice: 0.02,
21-
}
22-
2313
describe("OpenRouterHandler", () => {
2414
const mockOptions: ApiHandlerOptions = {
2515
openRouterApiKey: "test-key",
2616
openRouterModelId: "anthropic/claude-3.7-sonnet",
2717
}
2818

29-
beforeEach(() => {
30-
jest.clearAllMocks()
31-
})
19+
beforeEach(() => jest.clearAllMocks())
3220

3321
it("initializes with correct options", () => {
3422
const handler = new OpenRouterHandler(mockOptions)
@@ -183,7 +171,6 @@ describe("OpenRouterHandler", () => {
183171
;(OpenAI as jest.MockedClass<typeof OpenAI>).prototype.chat = {
184172
completions: { create: mockCreate },
185173
} as any
186-
;(axios.get as jest.Mock).mockResolvedValue({ data: { data: {} } })
187174

188175
await handler.createMessage("test", []).next()
189176

@@ -209,7 +196,6 @@ describe("OpenRouterHandler", () => {
209196
;(OpenAI as jest.MockedClass<typeof OpenAI>).prototype.chat = {
210197
completions: { create: mockCreate },
211198
} as any
212-
;(axios.get as jest.Mock).mockResolvedValue({ data: { data: {} } })
213199

214200
const messages: Anthropic.Messages.MessageParam[] = [
215201
{ role: "user", content: "message 1" },

src/core/Cline.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ import {
3333
import { getApiMetrics } from "../shared/getApiMetrics"
3434
import { HistoryItem } from "../shared/HistoryItem"
3535
import { ClineAskResponse } from "../shared/WebviewMessage"
36-
import { GlobalFileNames } from "../shared/globalFileNames"
3736
import { defaultModeSlug, getModeBySlug, getFullModeDetails, isToolAllowedForMode } from "../shared/modes"
3837
import { EXPERIMENT_IDS, experiments as Experiments, ExperimentId } from "../shared/experiments"
3938
import { formatLanguage } from "../shared/language"
@@ -2101,7 +2100,7 @@ export class Cline extends EventEmitter<ClineEvents> {
21012100
// Add this terminal's outputs to the details
21022101
if (terminalOutputs.length > 0) {
21032102
terminalDetails += `\n## Terminal ${inactiveTerminal.id}`
2104-
terminalOutputs.forEach((output, index) => {
2103+
terminalOutputs.forEach((output) => {
21052104
terminalDetails += `\n### New Output\n${output}`
21062105
})
21072106
}

src/core/webview/ClineProvider.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,15 @@ import {
1616
ApiConfiguration,
1717
ApiProvider,
1818
requestyDefaultModelId,
19-
requestyDefaultModelInfo,
2019
openRouterDefaultModelId,
21-
openRouterDefaultModelInfo,
2220
glamaDefaultModelId,
23-
glamaDefaultModelInfo,
2421
} from "../../shared/api"
2522
import { findLast } from "../../shared/array"
2623
import { supportPrompt } from "../../shared/support-prompt"
2724
import { GlobalFileNames } from "../../shared/globalFileNames"
2825
import { HistoryItem } from "../../shared/HistoryItem"
2926
import { ExtensionMessage } from "../../shared/ExtensionMessage"
30-
import { Mode, PromptComponent, defaultModeSlug, getModeBySlug, getGroupName } from "../../shared/modes"
27+
import { Mode, PromptComponent, defaultModeSlug } from "../../shared/modes"
3128
import { experimentDefault } from "../../shared/experiments"
3229
import { formatLanguage } from "../../shared/language"
3330
import { Terminal, TERMINAL_SHELL_INTEGRATION_TIMEOUT } from "../../integrations/terminal/Terminal"
@@ -340,6 +337,10 @@ export class ClineProvider extends EventEmitter<ClineProviderEvents> implements
340337
this.log("Resolving webview view")
341338
this.view = webviewView
342339

340+
if (!this.contextProxy.isInitialized) {
341+
await this.contextProxy.initialize()
342+
}
343+
343344
// Set panel reference according to webview type
344345
if ("onDidChangeViewState" in webviewView) {
345346
// Tag page type

src/exports/api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import * as path from "path"
66
import { getWorkspacePath } from "../utils/path"
77
import { ClineProvider } from "../core/webview/ClineProvider"
88
import { openClineInNewTab } from "../activate/registerCommands"
9-
import { RooCodeSettings, RooCodeEvents, RooCodeEventName, ClineMessage } from "../schemas"
9+
import { RooCodeSettings, RooCodeEvents, RooCodeEventName } from "../schemas"
1010
import { IpcOrigin, IpcMessageType, TaskCommandName, TaskEvent } from "../schemas/ipc"
1111

1212
import { RooCodeAPI } from "./interface"

0 commit comments

Comments
 (0)