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/components/Footer.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/components/Footer.test.tsx')
| -rw-r--r-- | packages/cli/src/ui/components/Footer.test.tsx | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/packages/cli/src/ui/components/Footer.test.tsx b/packages/cli/src/ui/components/Footer.test.tsx index 5e79eea4..e3673dfe 100644 --- a/packages/cli/src/ui/components/Footer.test.tsx +++ b/packages/cli/src/ui/components/Footer.test.tsx @@ -103,4 +103,57 @@ describe('<Footer />', () => { expect(lastFrame()).toContain(defaultProps.model); expect(lastFrame()).toMatch(/\(\d+% context[\s\S]*left\)/); }); + + describe('sandbox and trust info', () => { + it('should display untrusted when isTrustedFolder is false', () => { + const { lastFrame } = renderWithWidth(120, { + ...defaultProps, + isTrustedFolder: false, + }); + expect(lastFrame()).toContain('untrusted'); + }); + + it('should display custom sandbox info when SANDBOX env is set', () => { + vi.stubEnv('SANDBOX', 'gemini-cli-test-sandbox'); + const { lastFrame } = renderWithWidth(120, { + ...defaultProps, + isTrustedFolder: undefined, + }); + expect(lastFrame()).toContain('test'); + vi.unstubAllEnvs(); + }); + + it('should display macOS Seatbelt info when SANDBOX is sandbox-exec', () => { + vi.stubEnv('SANDBOX', 'sandbox-exec'); + vi.stubEnv('SEATBELT_PROFILE', 'test-profile'); + const { lastFrame } = renderWithWidth(120, { + ...defaultProps, + isTrustedFolder: true, + }); + expect(lastFrame()).toMatch(/macOS Seatbelt.*\(test-profile\)/s); + vi.unstubAllEnvs(); + }); + + it('should display "no sandbox" when SANDBOX is not set and folder is trusted', () => { + // Clear any SANDBOX env var that might be set. + vi.stubEnv('SANDBOX', ''); + const { lastFrame } = renderWithWidth(120, { + ...defaultProps, + isTrustedFolder: true, + }); + expect(lastFrame()).toContain('no sandbox'); + vi.unstubAllEnvs(); + }); + + it('should prioritize untrusted message over sandbox info', () => { + vi.stubEnv('SANDBOX', 'gemini-cli-test-sandbox'); + const { lastFrame } = renderWithWidth(120, { + ...defaultProps, + isTrustedFolder: false, + }); + expect(lastFrame()).toContain('untrusted'); + expect(lastFrame()).not.toMatch(/test-sandbox/s); + vi.unstubAllEnvs(); + }); + }); }); |
