diff options
| author | Jacob Richman <[email protected]> | 2025-06-06 07:55:28 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-06-06 07:55:28 -0700 |
| commit | 4262f5b0de6933c5dd475a4f081ff09e97583bfa (patch) | |
| tree | 4ec00eccb9de3ca5832c21496e7c8bd176baa4de /packages/cli/src/ui/App.test.tsx | |
| parent | c80ff146d27f0afc159456c2c40844f281bc18a8 (diff) | |
feat(cli): respect the NO_COLOR env variable (#772)
Diffstat (limited to 'packages/cli/src/ui/App.test.tsx')
| -rw-r--r-- | packages/cli/src/ui/App.test.tsx | 59 |
1 files changed, 46 insertions, 13 deletions
diff --git a/packages/cli/src/ui/App.test.tsx b/packages/cli/src/ui/App.test.tsx index 01acd2d3..c1430bb5 100644 --- a/packages/cli/src/ui/App.test.tsx +++ b/packages/cli/src/ui/App.test.tsx @@ -15,6 +15,7 @@ import { AccessibilitySettings, } from '@gemini-code/core'; import { LoadedSettings, SettingsFile, Settings } from '../config/settings.js'; +import process from 'node:process'; // Define a more complete mock server config based on actual Config interface MockServerConfig { @@ -345,20 +346,52 @@ describe('App UI', () => { expect(lastFrame()).toContain('Using 2 MCP servers'); }); - it('should display theme dialog if no theme is set in settings', async () => { - mockSettings = createMockSettings({}); - mockConfig.getDebugMode.mockReturnValue(false); - mockConfig.getShowMemoryUsage.mockReturnValue(false); + describe('when no theme is set', () => { + let originalNoColor: string | undefined; - const { lastFrame, unmount } = render( - <App - config={mockConfig as unknown as ServerConfig} - settings={mockSettings} - cliVersion="1.0.0" - />, - ); - currentUnmount = unmount; + beforeEach(() => { + originalNoColor = process.env.NO_COLOR; + // Ensure no theme is set for these tests + mockSettings = createMockSettings({}); + mockConfig.getDebugMode.mockReturnValue(false); + mockConfig.getShowMemoryUsage.mockReturnValue(false); + }); + + afterEach(() => { + process.env.NO_COLOR = originalNoColor; + }); + + it('should display theme dialog if NO_COLOR is not set', async () => { + delete process.env.NO_COLOR; + + const { lastFrame, unmount } = render( + <App + config={mockConfig as unknown as ServerConfig} + settings={mockSettings} + cliVersion="1.0.0" + />, + ); + currentUnmount = unmount; - expect(lastFrame()).toContain('Select Theme'); + expect(lastFrame()).toContain('Select Theme'); + }); + + it('should display a message if NO_COLOR is set', async () => { + process.env.NO_COLOR = 'true'; + + const { lastFrame, unmount } = render( + <App + config={mockConfig as unknown as ServerConfig} + settings={mockSettings} + cliVersion="1.0.0" + />, + ); + currentUnmount = unmount; + + expect(lastFrame()).toContain( + 'Theme configuration unavailable due to NO_COLOR env variable.', + ); + expect(lastFrame()).not.toContain('Select Theme'); + }); }); }); |
