@@ -277,26 +277,42 @@ describe("FileWatcher", () => {
277277 } )
278278
279279 it ( "should process files when workspace is under hidden parent directory" , async ( ) => {
280- // Create file watcher with workspace under hidden parent directory
280+ // Mock parseFile to return blocks for this test
281+ const { codeParser } = await import ( "../parser" )
282+ vi . mocked ( codeParser . parseFile ) . mockResolvedValue ( [
283+ {
284+ file_path : "/Users/test/.config/project/src/file.ts" ,
285+ content : "test content" ,
286+ start_line : 1 ,
287+ end_line : 5 ,
288+ identifier : "test" ,
289+ type : "function" ,
290+ fileHash : "hash" ,
291+ segmentHash : "segment-hash" ,
292+ } as any ,
293+ ] )
294+
295+ // Create a new watcher instance with workspace under hidden parent
281296 const watcherUnderHidden = new FileWatcher (
282297 "/Users/test/.config/project" ,
283298 mockContext ,
284299 mockCacheManager ,
285300 mockEmbedder ,
286301 mockVectorStore ,
287- mockIgnoreInstance ,
288302 )
289303
290304 await watcherUnderHidden . initialize ( )
291305
292- // Simulate file creation in workspace under hidden parent
293- await mockOnDidCreate ( { fsPath : "/Users/test/.config/project/src/file.ts" } )
306+ // Capture the event handler for the new watcher instance
307+ const createHandler = mockWatcher . onDidCreate . mock . calls [ mockWatcher . onDidCreate . mock . calls . length - 1 ] [ 0 ]
308+
309+ // Simulate file creation using the captured handler
310+ await createHandler ( { fsPath : "/Users/test/.config/project/src/file.ts" } )
294311
295312 // Wait for batch processing
296313 await new Promise ( ( resolve ) => setTimeout ( resolve , 600 ) )
297314
298315 // File should be processed, not filtered out
299- // The key assertion is that upsertPoints was called, meaning the file wasn't filtered
300316 expect ( mockVectorStore . upsertPoints ) . toHaveBeenCalled ( )
301317 } )
302318 } )
0 commit comments