11import { describe , it , expect , vi , beforeEach } from "vitest"
22import { applyDiffTool } from "../multiApplyDiffTool"
3- import { applyDiffToolLegacy } from "../applyDiffTool"
4- import { Task } from "../../task/Task"
53import { EXPERIMENT_IDS , experiments } from "../../../shared/experiments"
64
7- vi . mock ( "../applyDiffToolLegacy" )
5+ // Mock the applyDiffTool module
6+ vi . mock ( "../applyDiffTool" , ( ) => ( {
7+ applyDiffToolLegacy : vi . fn ( ) ,
8+ } ) )
9+
10+ // Import after mocking to get the mocked version
11+ import { applyDiffToolLegacy } from "../applyDiffTool"
812
913describe ( "applyDiffTool experiment routing" , ( ) => {
1014 let mockCline : any
@@ -34,6 +38,9 @@ describe("applyDiffTool experiment routing", () => {
3438 diffViewProvider : {
3539 reset : vi . fn ( ) ,
3640 } ,
41+ api : {
42+ getModel : vi . fn ( ) . mockReturnValue ( { id : "test-model" } ) ,
43+ } ,
3744 } as any
3845
3946 mockBlock = {
@@ -57,6 +64,9 @@ describe("applyDiffTool experiment routing", () => {
5764 } ,
5865 } )
5966
67+ // Mock the legacy tool to resolve successfully
68+ ; ( applyDiffToolLegacy as any ) . mockResolvedValue ( undefined )
69+
6070 await applyDiffTool (
6171 mockCline ,
6272 mockBlock ,
@@ -79,6 +89,9 @@ describe("applyDiffTool experiment routing", () => {
7989 it ( "should use legacy tool when experiments are not defined" , async ( ) => {
8090 mockProvider . getState . mockResolvedValue ( { } )
8191
92+ // Mock the legacy tool to resolve successfully
93+ ; ( applyDiffToolLegacy as any ) . mockResolvedValue ( undefined )
94+
8295 await applyDiffTool (
8396 mockCline ,
8497 mockBlock ,
0 commit comments