Skip to content

Commit 2c51307

Browse files
committed
fix: update test to properly mock vscode.commands and expect correct log messages
1 parent 85a857f commit 2c51307

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/activate/__tests__/registerCommands.spec.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ vi.mock("vscode", () => ({
1313
QuickFix: { value: "quickfix" },
1414
RefactorRewrite: { value: "refactor.rewrite" },
1515
},
16+
commands: {
17+
executeCommand: vi.fn().mockResolvedValue(undefined),
18+
},
1619
window: {
1720
createTextEditorDecorationType: vi.fn().mockReturnValue({ dispose: vi.fn() }),
1821
},
@@ -62,6 +65,12 @@ describe("getVisibleProviderOrLog", () => {
6265
const result = await getVisibleProviderOrLog(mockOutputChannel)
6366

6467
expect(result).toBeUndefined()
65-
expect(mockOutputChannel.appendLine).toHaveBeenCalledWith("Cannot find any visible Roo Code instances.")
68+
// The function now logs multiple messages during the retry process
69+
expect(mockOutputChannel.appendLine).toHaveBeenCalledWith(
70+
"No visible Roo Code instance found, attempting to activate sidebar view...",
71+
)
72+
expect(mockOutputChannel.appendLine).toHaveBeenCalledWith(
73+
"Cannot find any visible Roo Code instances after activation attempt.",
74+
)
6675
})
6776
})

0 commit comments

Comments
 (0)