diff options
| author | Bryant Chandler <[email protected]> | 2025-08-05 23:33:27 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-08-06 06:33:27 +0000 |
| commit | aab850668c99e1c39a55036069d9f4b06ca458f4 (patch) | |
| tree | f134a01a96c18f4185536503c91033454b31e1ec /packages/cli/src/ui/hooks/useAtCompletion.test.ts | |
| parent | 8b1d5a2e3c84e488d90184e7da856cf1130ea5ef (diff) | |
feat(file-search): Add support for non-recursive file search (#5648)
Co-authored-by: Jacob Richman <[email protected]>
Diffstat (limited to 'packages/cli/src/ui/hooks/useAtCompletion.test.ts')
| -rw-r--r-- | packages/cli/src/ui/hooks/useAtCompletion.test.ts | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/packages/cli/src/ui/hooks/useAtCompletion.test.ts b/packages/cli/src/ui/hooks/useAtCompletion.test.ts index 58602d99..43289992 100644 --- a/packages/cli/src/ui/hooks/useAtCompletion.test.ts +++ b/packages/cli/src/ui/hooks/useAtCompletion.test.ts @@ -50,6 +50,7 @@ describe('useAtCompletion', () => { respectGitIgnore: true, respectGeminiIgnore: true, })), + getEnableRecursiveFileSearch: () => true, } as unknown as Config; vi.clearAllMocks(); }); @@ -431,5 +432,42 @@ describe('useAtCompletion', () => { await cleanupTmpDir(rootDir1); await cleanupTmpDir(rootDir2); }); + + it('should perform a non-recursive search when enableRecursiveFileSearch is false', async () => { + const structure: FileSystemStructure = { + 'file.txt': '', + src: { + 'index.js': '', + }, + }; + testRootDir = await createTmpDir(structure); + + const nonRecursiveConfig = { + getEnableRecursiveFileSearch: () => false, + getFileFilteringOptions: vi.fn(() => ({ + respectGitIgnore: true, + respectGeminiIgnore: true, + })), + } as unknown as Config; + + const { result } = renderHook(() => + useTestHarnessForAtCompletion( + true, + '', + nonRecursiveConfig, + testRootDir, + ), + ); + + await waitFor(() => { + expect(result.current.suggestions.length).toBeGreaterThan(0); + }); + + // Should only contain top-level items + expect(result.current.suggestions.map((s) => s.value)).toEqual([ + 'src/', + 'file.txt', + ]); + }); }); }); |
