@@ -4,7 +4,7 @@ import { join } from 'path';
44import { existsSync } from 'fs' ;
55import { loadConfig } from '../src/config.js' ;
66import { indexDirectories , scanDirectory , getFileMetadata , chunkText } from '../src/indexing.js' ;
7- import { searchContent , findSimilarFiles , getFileContent } from '../src/search.js' ;
7+ import { searchContent , findSimilarFiles , getFileContent , getChunkContent } from '../src/search.js' ;
88import { getIndexStatus , SQLiteStorage , QdrantClient } from '../src/storage.js' ;
99import { startMcpServer } from '../src/mcp.js' ;
1010import { createEmbeddingProvider } from '../src/embedding.js' ;
@@ -249,6 +249,17 @@ describe.sequential('Directory Indexer Integration Tests', () => {
249249 expect ( typeof chunkedContent ) . toBe ( 'string' ) ;
250250 }
251251
252+ // 6. Test getChunkContent function
253+ if ( searchResults . length > 0 && searchResults [ 0 ] . chunks . length > 0 ) {
254+ console . log ( '🔄 Testing getChunkContent() directly...' ) ;
255+ const firstResult = searchResults [ 0 ] ;
256+ const firstChunk = firstResult . chunks [ 0 ] ;
257+
258+ const chunkContent = await getChunkContent ( firstResult . filePath , firstChunk . chunkId ) ;
259+ expect ( typeof chunkContent ) . toBe ( 'string' ) ;
260+ expect ( chunkContent . length ) . toBeGreaterThan ( 0 ) ;
261+ }
262+
252263 console . log ( '✅ Direct function workflow completed successfully' ) ;
253264 } ) ;
254265 } ) ;
0 commit comments