From 1d3ad9d0758a94e42fa88d20618d164fe1140f11 Mon Sep 17 00:00:00 2001
From: christine betts <chrstn@uw.edu>
Date: Fri, 25 Jul 2025 14:50:34 +0000
Subject: Add drawer for active files in IDE mode (#4682)

Co-authored-by: Shreya <shreyakeshive@google.com>
---
 packages/cli/src/ui/App.test.tsx | 44 ++++++++++++++++++++++++++++++++--------
 1 file changed, 35 insertions(+), 9 deletions(-)

(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 0712d810..56093562 100644
--- a/packages/cli/src/ui/App.test.tsx
+++ b/packages/cli/src/ui/App.test.tsx
@@ -281,6 +281,7 @@ describe('App UI', () => {
   it('should display active file when available', async () => {
     vi.mocked(ideContext.getOpenFilesContext).mockReturnValue({
       activeFile: '/path/to/my-file.ts',
+      recentOpenFiles: [{ filePath: '/path/to/my-file.ts', content: 'hello' }],
       selectedText: 'hello',
     });
 
@@ -293,7 +294,7 @@ describe('App UI', () => {
     );
     currentUnmount = unmount;
     await Promise.resolve();
-    expect(lastFrame()).toContain('Open File (my-file.ts)');
+    expect(lastFrame()).toContain('1 recent file (ctrl+e to view)');
   });
 
   it('should not display active file when not available', async () => {
@@ -316,9 +317,11 @@ describe('App UI', () => {
   it('should display active file and other context', async () => {
     vi.mocked(ideContext.getOpenFilesContext).mockReturnValue({
       activeFile: '/path/to/my-file.ts',
+      recentOpenFiles: [{ filePath: '/path/to/my-file.ts', content: 'hello' }],
       selectedText: 'hello',
     });
     mockConfig.getGeminiMdFileCount.mockReturnValue(1);
+    mockConfig.getAllGeminiMdFilenames.mockReturnValue(['GEMINI.md']);
 
     const { lastFrame, unmount } = render(
       <App
@@ -329,11 +332,14 @@ describe('App UI', () => {
     );
     currentUnmount = unmount;
     await Promise.resolve();
-    expect(lastFrame()).toContain('Open File (my-file.ts) | 1 GEMINI.md File');
+    expect(lastFrame()).toContain(
+      'Using: 1 recent file (ctrl+e to view) | 1 GEMINI.md file',
+    );
   });
 
   it('should display default "GEMINI.md" in footer when contextFileName is not set and count is 1', async () => {
     mockConfig.getGeminiMdFileCount.mockReturnValue(1);
+    mockConfig.getAllGeminiMdFilenames.mockReturnValue(['GEMINI.md']);
     // For this test, ensure showMemoryUsage is false or debugMode is false if it relies on that
     mockConfig.getDebugMode.mockReturnValue(false);
     mockConfig.getShowMemoryUsage.mockReturnValue(false);
@@ -347,11 +353,15 @@ describe('App UI', () => {
     );
     currentUnmount = unmount;
     await Promise.resolve(); // Wait for any async updates
-    expect(lastFrame()).toContain('Using: 1 GEMINI.md File');
+    expect(lastFrame()).toContain('Using: 1 GEMINI.md file');
   });
 
   it('should display default "GEMINI.md" with plural when contextFileName is not set and count is > 1', async () => {
     mockConfig.getGeminiMdFileCount.mockReturnValue(2);
+    mockConfig.getAllGeminiMdFilenames.mockReturnValue([
+      'GEMINI.md',
+      'GEMINI.md',
+    ]);
     mockConfig.getDebugMode.mockReturnValue(false);
     mockConfig.getShowMemoryUsage.mockReturnValue(false);
 
@@ -364,7 +374,7 @@ describe('App UI', () => {
     );
     currentUnmount = unmount;
     await Promise.resolve();
-    expect(lastFrame()).toContain('Using: 2 GEMINI.md Files');
+    expect(lastFrame()).toContain('Using: 2 GEMINI.md files');
   });
 
   it('should display custom contextFileName in footer when set and count is 1', async () => {
@@ -372,6 +382,7 @@ describe('App UI', () => {
       workspace: { contextFileName: 'AGENTS.md', theme: 'Default' },
     });
     mockConfig.getGeminiMdFileCount.mockReturnValue(1);
+    mockConfig.getAllGeminiMdFilenames.mockReturnValue(['AGENTS.md']);
     mockConfig.getDebugMode.mockReturnValue(false);
     mockConfig.getShowMemoryUsage.mockReturnValue(false);
 
@@ -384,7 +395,7 @@ describe('App UI', () => {
     );
     currentUnmount = unmount;
     await Promise.resolve();
-    expect(lastFrame()).toContain('Using: 1 AGENTS.md File');
+    expect(lastFrame()).toContain('Using: 1 AGENTS.md file');
   });
 
   it('should display a generic message when multiple context files with different names are provided', async () => {
@@ -395,6 +406,10 @@ describe('App UI', () => {
       },
     });
     mockConfig.getGeminiMdFileCount.mockReturnValue(2);
+    mockConfig.getAllGeminiMdFilenames.mockReturnValue([
+      'AGENTS.md',
+      'CONTEXT.md',
+    ]);
     mockConfig.getDebugMode.mockReturnValue(false);
     mockConfig.getShowMemoryUsage.mockReturnValue(false);
 
@@ -407,7 +422,7 @@ describe('App UI', () => {
     );
     currentUnmount = unmount;
     await Promise.resolve();
-    expect(lastFrame()).toContain('Using: 2 Context Files');
+    expect(lastFrame()).toContain('Using: 2 context files');
   });
 
   it('should display custom contextFileName with plural when set and count is > 1', async () => {
@@ -415,6 +430,11 @@ describe('App UI', () => {
       workspace: { contextFileName: 'MY_NOTES.TXT', theme: 'Default' },
     });
     mockConfig.getGeminiMdFileCount.mockReturnValue(3);
+    mockConfig.getAllGeminiMdFilenames.mockReturnValue([
+      'MY_NOTES.TXT',
+      'MY_NOTES.TXT',
+      'MY_NOTES.TXT',
+    ]);
     mockConfig.getDebugMode.mockReturnValue(false);
     mockConfig.getShowMemoryUsage.mockReturnValue(false);
 
@@ -427,7 +447,7 @@ describe('App UI', () => {
     );
     currentUnmount = unmount;
     await Promise.resolve();
-    expect(lastFrame()).toContain('Using: 3 MY_NOTES.TXT Files');
+    expect(lastFrame()).toContain('Using: 3 MY_NOTES.TXT files');
   });
 
   it('should not display context file message if count is 0, even if contextFileName is set', async () => {
@@ -435,6 +455,7 @@ describe('App UI', () => {
       workspace: { contextFileName: 'ANY_FILE.MD', theme: 'Default' },
     });
     mockConfig.getGeminiMdFileCount.mockReturnValue(0);
+    mockConfig.getAllGeminiMdFilenames.mockReturnValue([]);
     mockConfig.getDebugMode.mockReturnValue(false);
     mockConfig.getShowMemoryUsage.mockReturnValue(false);
 
@@ -452,6 +473,10 @@ describe('App UI', () => {
 
   it('should display GEMINI.md and MCP server count when both are present', async () => {
     mockConfig.getGeminiMdFileCount.mockReturnValue(2);
+    mockConfig.getAllGeminiMdFilenames.mockReturnValue([
+      'GEMINI.md',
+      'GEMINI.md',
+    ]);
     mockConfig.getMcpServers.mockReturnValue({
       server1: {} as MCPServerConfig,
     });
@@ -467,11 +492,12 @@ describe('App UI', () => {
     );
     currentUnmount = unmount;
     await Promise.resolve();
-    expect(lastFrame()).toContain('1 MCP Server');
+    expect(lastFrame()).toContain('1 MCP server');
   });
 
   it('should display only MCP server count when GEMINI.md count is 0', async () => {
     mockConfig.getGeminiMdFileCount.mockReturnValue(0);
+    mockConfig.getAllGeminiMdFilenames.mockReturnValue([]);
     mockConfig.getMcpServers.mockReturnValue({
       server1: {} as MCPServerConfig,
       server2: {} as MCPServerConfig,
@@ -488,7 +514,7 @@ describe('App UI', () => {
     );
     currentUnmount = unmount;
     await Promise.resolve();
-    expect(lastFrame()).toContain('Using: 2 MCP Servers');
+    expect(lastFrame()).toContain('Using: 2 MCP servers (ctrl+t to view)');
   });
 
   it('should display Tips component by default', async () => {
-- 
cgit v1.2.3

