11import { BuiltInToolNames } from "core/tools/builtIn" ;
2+ import { generateToolCallButtonTestId } from "../../../components/mainInput/Lump/LumpToolbar/PendingToolCallToolbar" ;
23import {
34 addAndSelectMockLlm ,
45 triggerConfigUpdate ,
56} from "../../../util/test/config" ;
67import { renderWithProviders } from "../../../util/test/render" ;
78import { Chat } from "../Chat" ;
8- import { generateToolCallButtonTestId } from "../../../components/mainInput/Lump/LumpToolbar/PendingToolCallToolbar" ;
99
1010import { waitFor } from "@testing-library/dom" ;
1111import { act } from "@testing-library/react" ;
1212import { ChatMessage } from "core" ;
13- import {
14- setToolPolicy ,
15- toggleToolSetting ,
16- } from "../../../redux/slices/uiSlice" ;
13+ import { setToolPolicy } from "../../../redux/slices/uiSlice" ;
1714import {
1815 getElementByTestId ,
1916 getElementByText ,
6360
6461 ideMessenger . responses [ "getWorkspaceDirs" ] = [ EDIT_WORKSPACE_DIR ] ;
6562 const messengerPostSpy = vi . spyOn ( ideMessenger , "post" ) ;
63+ const messengerRequestSpy = vi . spyOn ( ideMessenger , "request" ) ;
6664
6765 addAndSelectMockLlm ( store , ideMessenger ) ;
6866
9290
9391 // Tool call, check that applyToFile was called for edit
9492 await waitFor ( ( ) => {
95- expect ( messengerPostSpy ) . toHaveBeenCalledWith ( "applyToFile" , {
93+ expect ( messengerRequestSpy ) . toHaveBeenCalledWith ( "applyToFile" , {
9694 streamId : expect . any ( String ) ,
9795 filepath : EDIT_FILE_URI ,
9896 text : EDIT_CHANGES ,
10199 } ) ;
102100
103101 // Extract stream ID and initiate mock streaming
104- const streamId = messengerPostSpy . mock . calls . find (
102+ const streamId = messengerRequestSpy . mock . calls . find (
105103 ( call ) => call [ 0 ] === "applyToFile" ,
106104 ) ?. [ 1 ] ?. streamId ;
107105 expect ( streamId ) . toBeDefined ( ) ;
@@ -172,6 +170,7 @@ test("Edit run with no policy and yolo mode", { timeout: 15000 }, async () => {
172170
173171 ideMessenger . responses [ "getWorkspaceDirs" ] = [ EDIT_WORKSPACE_DIR ] ;
174172 const messengerPostSpy = vi . spyOn ( ideMessenger , "post" ) ;
173+ const messengerRequestSpy = vi . spyOn ( ideMessenger , "request" ) ;
175174
176175 addAndSelectMockLlm ( store , ideMessenger ) ;
177176
@@ -219,7 +218,7 @@ test("Edit run with no policy and yolo mode", { timeout: 15000 }, async () => {
219218 ) ;
220219 // Tool call, check that applyToFile was called for edit
221220 await waitFor ( ( ) => {
222- expect ( messengerPostSpy ) . toHaveBeenCalledWith ( "applyToFile" , {
221+ expect ( messengerRequestSpy ) . toHaveBeenCalledWith ( "applyToFile" , {
223222 streamId : expect . any ( String ) ,
224223 filepath : EDIT_FILE_URI ,
225224 text : EDIT_CHANGES ,
@@ -228,7 +227,7 @@ test("Edit run with no policy and yolo mode", { timeout: 15000 }, async () => {
228227 } ) ;
229228
230229 // Extract stream ID and initiate mock streaming
231- const streamId = messengerPostSpy . mock . calls . find (
230+ const streamId = messengerRequestSpy . mock . calls . find (
232231 ( call ) => call [ 0 ] === "applyToFile" ,
233232 ) ?. [ 1 ] ?. streamId ;
234233 expect ( streamId ) . toBeDefined ( ) ;
0 commit comments