From 2a1ad1f5d961b9f9593a6016eea7dd398bdeed0b Mon Sep 17 00:00:00 2001 From: Billy Biggs Date: Fri, 13 Jun 2025 09:19:08 -0700 Subject: Update contextFileName to support an optional list of strings (#1001) --- packages/cli/src/ui/App.test.tsx | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'packages/cli/src/ui/App.test.tsx') diff --git a/packages/cli/src/ui/App.test.tsx b/packages/cli/src/ui/App.test.tsx index b8959bfb..201d0698 100644 --- a/packages/cli/src/ui/App.test.tsx +++ b/packages/cli/src/ui/App.test.tsx @@ -64,6 +64,7 @@ interface MockServerConfig { getShowMemoryUsage: Mock<() => boolean>; getAccessibility: Mock<() => AccessibilitySettings>; getProjectRoot: Mock<() => string | undefined>; + getAllGeminiMdFilenames: Mock<() => string[]>; } // Mock @gemini-cli/core and its Config class @@ -124,12 +125,14 @@ vi.mock('@gemini-cli/core', async (importOriginal) => { getProjectRoot: vi.fn(() => opts.projectRoot), getGeminiClient: vi.fn(() => ({})), getCheckpointEnabled: vi.fn(() => opts.checkpoint ?? true), + getAllGeminiMdFilenames: vi.fn(() => ['GEMINI.md']), }; }); return { ...actualCore, Config: ConfigClassMock, MCPServerConfig: actualCore.MCPServerConfig, + getAllGeminiMdFilenames: vi.fn(() => ['GEMINI.md']), }; }); @@ -269,6 +272,26 @@ describe('App UI', () => { expect(lastFrame()).toContain('Using 1 AGENTS.MD file'); }); + it('should display the first custom contextFileName when an array is provided', async () => { + mockSettings = createMockSettings({ + contextFileName: ['AGENTS.MD', 'CONTEXT.MD'], + theme: 'Default', + }); + mockConfig.getGeminiMdFileCount.mockReturnValue(2); + mockConfig.getDebugMode.mockReturnValue(false); + mockConfig.getShowMemoryUsage.mockReturnValue(false); + + const { lastFrame, unmount } = render( + , + ); + currentUnmount = unmount; + await Promise.resolve(); + expect(lastFrame()).toContain('Using 2 AGENTS.MD files'); + }); + it('should display custom contextFileName with plural when set and count is > 1', async () => { mockSettings = createMockSettings({ contextFileName: 'MY_NOTES.TXT', -- cgit v1.2.3