From a36915bf8a3f16244356c65943838654932dd29e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Max=20Paulus=20=F0=9F=A5=AA?= Date: Mon, 8 Jun 2026 12:57:44 -0700 Subject: [PATCH] fix ui test --- .../chat-view/hooks/useMessageHandlers.test.tsx | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/apps/vscode/webview-ui/src/components/chat/chat-view/hooks/useMessageHandlers.test.tsx b/apps/vscode/webview-ui/src/components/chat/chat-view/hooks/useMessageHandlers.test.tsx index 0199115c01..1e9db6c187 100644 --- a/apps/vscode/webview-ui/src/components/chat/chat-view/hooks/useMessageHandlers.test.tsx +++ b/apps/vscode/webview-ui/src/components/chat/chat-view/hooks/useMessageHandlers.test.tsx @@ -130,29 +130,33 @@ describe("useMessageHandlers — send routing", () => { expect(askResponse).not.toHaveBeenCalled() }) - it("blocks a NEW task when there is no usable provider (gate)", async () => { + it("still starts a NEW task when there is no usable provider", async () => { mockHasUsableProvider = false mockTurnState = { phase: "idle", seq: 1 } const { result } = renderHook(() => useMessageHandlers([], makeChatState([]))) await act(async () => { - await result.current.handleSendMessage("should be blocked", [], []) + await result.current.handleSendMessage("should be sent", [], []) }) - expect(newTask).not.toHaveBeenCalled() + expect(newTask).toHaveBeenCalledTimes(1) + expect(newTask).toHaveBeenCalledWith(expect.objectContaining({ text: "should be sent", images: [], files: [] })) expect(askResponse).not.toHaveBeenCalled() }) - it("blocks a follow-up when there is no usable provider (gate)", async () => { + it("still sends a follow-up when there is no usable provider", async () => { mockHasUsableProvider = false mockTurnState = { phase: "completed", seq: 7 } const { result } = renderHook(() => useMessageHandlers(completedConversation, makeChatState(completedConversation))) await act(async () => { - await result.current.handleSendMessage("should be blocked", [], []) + await result.current.handleSendMessage("should be sent", [], []) }) expect(newTask).not.toHaveBeenCalled() - expect(askResponse).not.toHaveBeenCalled() + expect(askResponse).toHaveBeenCalledTimes(1) + expect(askResponse).toHaveBeenCalledWith( + expect.objectContaining({ responseType: "messageResponse", text: "should be sent" }), + ) }) })