Skip to content

Commit 4e6e543

Browse files
test(webview): cover remaining Copilot message handler paths
1 parent f9cfe77 commit 4e6e543

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

‎src/core/webview/__tests__/webviewMessageHandler.spec.ts‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,20 @@ describe("webviewMessageHandler - Copilot authentication", () => {
249249
})
250250
})
251251

252+
it("reports no account as null, so the webview clears a stale sign-in rather than keeping it", async () => {
253+
vi.spyOn(copilotProvider, "getGitHubCopilotAccount").mockResolvedValue(undefined)
254+
vi.spyOn(vsCodeLmProvider, "getVsCodeLmModels").mockResolvedValue([])
255+
await webviewMessageHandler(mockClineProvider, {
256+
type: "requestVsCodeLmModels",
257+
apiConfiguration: { apiProvider: providerIdentifiers.githubCopilot },
258+
})
259+
expect(mockClineProvider.postMessageToWebview).toHaveBeenCalledWith({
260+
type: "githubCopilotModels",
261+
githubCopilotAccount: null,
262+
vsCodeLmModels: [],
263+
})
264+
})
265+
252266
it("shows model discovery errors instead of silently returning an empty list", async () => {
253267
vi.spyOn(copilotProvider, "getGitHubCopilotAccount").mockResolvedValue("Test User")
254268
vi.spyOn(vsCodeLmProvider, "getVsCodeLmModels").mockRejectedValue(new Error("Model access denied"))

0 commit comments

Comments
 (0)