99 beforeAll ,
1010 beforeEach ,
1111 mock as bunMockFn ,
12- spyOn as bunSpyOn ,
1312 describe ,
1413 expect ,
1514 it ,
@@ -63,8 +62,6 @@ describe('requestRelevantFiles', () => {
6362 const mockCostMode : CostMode = 'normal'
6463 const mockRepoId = 'owner/repo'
6564
66- let getCustomFilePickerConfigForOrgSpy : any // Explicitly typed as any
67-
6865 beforeAll ( ( ) => {
6966 mockModule ( '@codebuff/backend/llm-apis/gemini-with-fallbacks' , ( ) => ( {
7067 promptFlashWithFallbacks : bunMockFn ( ( ) =>
@@ -100,21 +97,6 @@ describe('requestRelevantFiles', () => {
10097 beforeEach ( ( ) => {
10198 agentRuntimeImpl = { ...TEST_AGENT_RUNTIME_IMPL }
10299
103- // If the spy was created in a previous test, restore it
104- if (
105- getCustomFilePickerConfigForOrgSpy &&
106- typeof getCustomFilePickerConfigForOrgSpy . mockRestore === 'function'
107- ) {
108- getCustomFilePickerConfigForOrgSpy . mockRestore ( )
109- getCustomFilePickerConfigForOrgSpy = undefined
110- }
111-
112- // Use the directly imported bunSpyOn
113- getCustomFilePickerConfigForOrgSpy = bunSpyOn (
114- OriginalRequestFilesPromptModule ,
115- 'getCustomFilePickerConfigForOrg' ,
116- ) . mockResolvedValue ( null )
117-
118100 const promptFlashWithFallbacksMock =
119101 geminiWithFallbacksModule . promptFlashWithFallbacks as Mock <
120102 typeof geminiWithFallbacksModule . promptFlashWithFallbacks
@@ -140,7 +122,6 @@ describe('requestRelevantFiles', () => {
140122 expect (
141123 geminiWithFallbacksModule . promptFlashWithFallbacks ,
142124 ) . toHaveBeenCalled ( )
143- expect ( getCustomFilePickerConfigForOrgSpy ) . toHaveBeenCalled ( )
144125 } )
145126
146127 it ( 'should use custom file counts from config' , async ( ) => {
@@ -149,7 +130,6 @@ describe('requestRelevantFiles', () => {
149130 customFileCounts : { normal : 5 } ,
150131 maxFilesPerRequest : 10 ,
151132 }
152- getCustomFilePickerConfigForOrgSpy ! . mockResolvedValue ( customConfig as any )
153133
154134 await OriginalRequestFilesPromptModule . requestRelevantFiles ( {
155135 ...agentRuntimeImpl ,
@@ -167,15 +147,13 @@ describe('requestRelevantFiles', () => {
167147 expect (
168148 geminiWithFallbacksModule . promptFlashWithFallbacks ,
169149 ) . toHaveBeenCalled ( )
170- expect ( getCustomFilePickerConfigForOrgSpy ) . toHaveBeenCalled ( )
171150 } )
172151
173152 it ( 'should use custom maxFilesPerRequest from config' , async ( ) => {
174153 const customConfig = {
175154 modelName : 'ft_filepicker_005' ,
176155 maxFilesPerRequest : 3 ,
177156 }
178- getCustomFilePickerConfigForOrgSpy ! . mockResolvedValue ( customConfig as any )
179157
180158 const result = await OriginalRequestFilesPromptModule . requestRelevantFiles ( {
181159 ...agentRuntimeImpl ,
@@ -194,14 +172,12 @@ describe('requestRelevantFiles', () => {
194172 if ( result ) {
195173 expect ( result . length ) . toBeLessThanOrEqual ( 3 )
196174 }
197- expect ( getCustomFilePickerConfigForOrgSpy ) . toHaveBeenCalled ( )
198175 } )
199176
200177 it ( 'should use custom modelName from config' , async ( ) => {
201178 const customConfig = {
202179 modelName : 'ft_filepicker_010' ,
203180 }
204- getCustomFilePickerConfigForOrgSpy ! . mockResolvedValue ( customConfig as any )
205181
206182 await OriginalRequestFilesPromptModule . requestRelevantFiles ( {
207183 ...agentRuntimeImpl ,
@@ -223,14 +199,12 @@ describe('requestRelevantFiles', () => {
223199 useFinetunedModel : finetunedVertexModels . ft_filepicker_010 ,
224200 } ) ,
225201 )
226- expect ( getCustomFilePickerConfigForOrgSpy ) . toHaveBeenCalled ( )
227202 } )
228203
229204 it ( 'should use default model if custom modelName is invalid' , async ( ) => {
230205 const customConfig = {
231206 modelName : 'invalid-model-name' ,
232207 }
233- getCustomFilePickerConfigForOrgSpy ! . mockResolvedValue ( customConfig as any )
234208
235209 await OriginalRequestFilesPromptModule . requestRelevantFiles ( {
236210 ...agentRuntimeImpl ,
@@ -253,6 +227,5 @@ describe('requestRelevantFiles', () => {
253227 useFinetunedModel : expectedModel ,
254228 } ) ,
255229 )
256- expect ( getCustomFilePickerConfigForOrgSpy ) . toHaveBeenCalled ( )
257230 } )
258231} )
0 commit comments