Skip to content

Commit a069c2d

Browse files
test(activate): give the focusPanel doubles distinct viewType values so the argument assertion bites
1 parent e3d2460 commit a069c2d

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

‎src/activate/__tests__/registerCommands.spec.ts‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -582,9 +582,12 @@ describe("registerCommands handlers", () => {
582582
})
583583

584584
it("focusInput posts to the tab provider when a tab panel is tracked alongside the sidebar", async () => {
585-
const sidebarView = {} as vscode.WebviewView
585+
const sidebarView = { viewType: "sidebar-view" } as vscode.WebviewView
586586
setPanel(sidebarView, "sidebar")
587-
const tabPanel = {} as vscode.WebviewPanel
587+
const tabPanel = { viewType: "tab-panel" } as vscode.WebviewPanel
588+
// The two doubles carry distinct viewType values on purpose: toHaveBeenCalledWith compares
589+
// deeply, so two structurally empty objects would make a swapped focusPanel call
590+
// indistinguishable from the expected one and the argument assertion at the end of this row could never fail.
588591
setPanel(tabPanel, "tab")
589592
const tabProvider = { postMessageToWebview: vi.fn().mockResolvedValue(undefined) }
590593
;(ClineProvider.getInstanceForView as Mock).mockReturnValue(tabProvider)

0 commit comments

Comments
 (0)