File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed
src/services/code-index/processors/__tests__ Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -127,6 +127,22 @@ vi.mock("../../../utils/path", () => ({
127127 getWorkspacePath : vi . fn ( ) . mockReturnValue ( "/mock/workspace" ) ,
128128} ) )
129129
130+ // Also mock the get-relative-path module to ensure it uses our mocked getWorkspacePath
131+ vi . mock ( "../../shared/get-relative-path" , async ( ) => {
132+ const actual = await vi . importActual ( "../../shared/get-relative-path" )
133+ return {
134+ ...actual ,
135+ generateRelativeFilePath : vi . fn ( ( absolutePath : string ) => {
136+ // Mock the relative path calculation
137+ const workspaceRoot = "/mock/workspace"
138+ if ( absolutePath . startsWith ( workspaceRoot ) ) {
139+ return absolutePath . substring ( workspaceRoot . length + 1 )
140+ }
141+ return absolutePath
142+ } ) ,
143+ }
144+ } )
145+
130146// Type the mocked functions for proper intellisense
131147const mockedVscode = vi . mocked ( vscode , true )
132148
@@ -467,7 +483,7 @@ describe("FileWatcher", () => {
467483 id : "mocked-uuid-v5-for-testing" ,
468484 vector : [ 0.1 , 0.2 , 0.3 ] ,
469485 payload : {
470- filePath : "../../../../../mock/workspace/ test.js" ,
486+ filePath : "test.js" ,
471487 codeChunk : "test content" ,
472488 startLine : 1 ,
473489 endLine : 5 ,
You can’t perform that action at this time.
0 commit comments