diff options
| author | shrutip90 <[email protected]> | 2025-08-14 11:15:48 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-08-14 18:15:48 +0000 |
| commit | 69c55827239b5c937c177eef4b4fbcc2758ef23e (patch) | |
| tree | f2dc2f1a55e64cd9a235bcf0e3d9caaa7f552b7c /packages/cli/src/ui/App.test.tsx | |
| parent | 69d666cfafe97e49a6cacb306df9a737d4aa9f20 (diff) | |
feat: Show untrusted status in the Footer (#6210)
Co-authored-by: Jacob Richman <[email protected]>
Diffstat (limited to 'packages/cli/src/ui/App.test.tsx')
| -rw-r--r-- | packages/cli/src/ui/App.test.tsx | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/packages/cli/src/ui/App.test.tsx b/packages/cli/src/ui/App.test.tsx index c797b778..64cd5842 100644 --- a/packages/cli/src/ui/App.test.tsx +++ b/packages/cli/src/ui/App.test.tsx @@ -163,6 +163,7 @@ vi.mock('@google/gemini-cli-core', async (importOriginal) => { getCurrentIde: vi.fn(() => 'vscode'), getDetectedIdeDisplayName: vi.fn(() => 'VSCode'), })), + isTrustedFolder: vi.fn(() => true), }; }); @@ -1118,5 +1119,45 @@ describe('App UI', () => { await Promise.resolve(); expect(lastFrame()).toContain('Do you trust this folder?'); }); + + it('should display the folder trust dialog when the feature is enabled but the folder is not trusted', async () => { + const { useFolderTrust } = await import('./hooks/useFolderTrust.js'); + vi.mocked(useFolderTrust).mockReturnValue({ + isFolderTrustDialogOpen: true, + handleFolderTrustSelect: vi.fn(), + }); + mockConfig.isTrustedFolder.mockReturnValue(false); + + const { lastFrame, unmount } = render( + <App + config={mockConfig as unknown as ServerConfig} + settings={mockSettings} + version={mockVersion} + />, + ); + currentUnmount = unmount; + await Promise.resolve(); + expect(lastFrame()).toContain('Do you trust this folder?'); + }); + + it('should not display the folder trust dialog when the feature is disabled', async () => { + const { useFolderTrust } = await import('./hooks/useFolderTrust.js'); + vi.mocked(useFolderTrust).mockReturnValue({ + isFolderTrustDialogOpen: false, + handleFolderTrustSelect: vi.fn(), + }); + mockConfig.isTrustedFolder.mockReturnValue(false); + + const { lastFrame, unmount } = render( + <App + config={mockConfig as unknown as ServerConfig} + settings={mockSettings} + version={mockVersion} + />, + ); + currentUnmount = unmount; + await Promise.resolve(); + expect(lastFrame()).not.toContain('Do you trust this folder?'); + }); }); }); |
