summaryrefslogtreecommitdiff
path: root/packages/cli/src/ui/App.test.tsx
diff options
context:
space:
mode:
authorBilly Biggs <[email protected]>2025-06-13 09:19:08 -0700
committerGitHub <[email protected]>2025-06-13 09:19:08 -0700
commit2a1ad1f5d961b9f9593a6016eea7dd398bdeed0b (patch)
tree9e83f9421ef9b01f30454c5af3db90540381d1e3 /packages/cli/src/ui/App.test.tsx
parent34e0d9c0b65b91b12df4f205d9835e05913992b9 (diff)
Update contextFileName to support an optional list of strings (#1001)
Diffstat (limited to 'packages/cli/src/ui/App.test.tsx')
-rw-r--r--packages/cli/src/ui/App.test.tsx23
1 files changed, 23 insertions, 0 deletions
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(
+ <App
+ config={mockConfig as unknown as ServerConfig}
+ settings={mockSettings}
+ />,
+ );
+ 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',