summaryrefslogtreecommitdiff
path: root/packages/cli/src/ui/hooks/useCompletion.integration.test.ts
diff options
context:
space:
mode:
authorzfflxx <[email protected]>2025-07-07 13:48:39 +0800
committerGitHub <[email protected]>2025-07-07 05:48:39 +0000
commit97d9386e3feba8748ec555707b2f6b75bc3b15a8 (patch)
treeaa685660be2f289d8e253a107498f49b01cc7cf1 /packages/cli/src/ui/hooks/useCompletion.integration.test.ts
parentbb8f6b376d83a9b70406279c87ab8b163fb32a38 (diff)
@file don't respect config respectGitIgnore=false (#3382) (#3387)
Co-authored-by: Ryan Fang <[email protected]>
Diffstat (limited to 'packages/cli/src/ui/hooks/useCompletion.integration.test.ts')
-rw-r--r--packages/cli/src/ui/hooks/useCompletion.integration.test.ts35
1 files changed, 35 insertions, 0 deletions
diff --git a/packages/cli/src/ui/hooks/useCompletion.integration.test.ts b/packages/cli/src/ui/hooks/useCompletion.integration.test.ts
index 6a178fb1..f5864a58 100644
--- a/packages/cli/src/ui/hooks/useCompletion.integration.test.ts
+++ b/packages/cli/src/ui/hooks/useCompletion.integration.test.ts
@@ -41,7 +41,10 @@ describe('useCompletion git-aware filtering integration', () => {
beforeEach(() => {
mockFileDiscoveryService = {
shouldGitIgnoreFile: vi.fn(),
+ shouldGeminiIgnoreFile: vi.fn(),
+ shouldIgnoreFile: vi.fn(),
filterFiles: vi.fn(),
+ getGeminiIgnorePatterns: vi.fn(() => []),
};
mockConfig = {
@@ -68,6 +71,14 @@ describe('useCompletion git-aware filtering integration', () => {
mockFileDiscoveryService.shouldGitIgnoreFile.mockImplementation(
(path: string) => path.includes('dist'),
);
+ mockFileDiscoveryService.shouldIgnoreFile.mockImplementation(
+ (path: string, options) => {
+ if (options?.respectGitIgnore !== false) {
+ return mockFileDiscoveryService.shouldGitIgnoreFile(path);
+ }
+ return false;
+ },
+ );
const { result } = renderHook(() =>
useCompletion('@d', testCwd, true, slashCommands, mockConfig),
@@ -102,6 +113,14 @@ describe('useCompletion git-aware filtering integration', () => {
path.includes('dist') ||
path.includes('.env'),
);
+ mockFileDiscoveryService.shouldIgnoreFile.mockImplementation(
+ (path: string, options) => {
+ if (options?.respectGitIgnore !== false) {
+ return mockFileDiscoveryService.shouldGitIgnoreFile(path);
+ }
+ return false;
+ },
+ );
const { result } = renderHook(() =>
useCompletion('@', testCwd, true, slashCommands, mockConfig),
@@ -153,6 +172,14 @@ describe('useCompletion git-aware filtering integration', () => {
mockFileDiscoveryService.shouldGitIgnoreFile.mockImplementation(
(path: string) => path.includes('node_modules') || path.includes('temp'),
);
+ mockFileDiscoveryService.shouldIgnoreFile.mockImplementation(
+ (path: string, options) => {
+ if (options?.respectGitIgnore !== false) {
+ return mockFileDiscoveryService.shouldGitIgnoreFile(path);
+ }
+ return false;
+ },
+ );
const { result } = renderHook(() =>
useCompletion('@t', testCwd, true, slashCommands, mockConfig),
@@ -261,6 +288,14 @@ describe('useCompletion git-aware filtering integration', () => {
mockFileDiscoveryService.shouldGitIgnoreFile.mockImplementation(
(path: string) => path.includes('.log'),
);
+ mockFileDiscoveryService.shouldIgnoreFile.mockImplementation(
+ (path: string, options) => {
+ if (options?.respectGitIgnore !== false) {
+ return mockFileDiscoveryService.shouldGitIgnoreFile(path);
+ }
+ return false;
+ },
+ );
const { result } = renderHook(() =>
useCompletion('@src/comp', testCwd, true, slashCommands, mockConfig),