From 04518b52c0ddcd5ae1192763c55e472add218b3c Mon Sep 17 00:00:00 2001 From: matt korwel Date: Thu, 19 Jun 2025 16:52:22 -0700 Subject: Auth First Run (#1207) Co-authored-by: Tommaso Sciortino Co-authored-by: N. Taylor Mullen --- packages/cli/src/ui/components/AuthDialog.test.tsx | 41 ++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 packages/cli/src/ui/components/AuthDialog.test.tsx (limited to 'packages/cli/src/ui/components/AuthDialog.test.tsx') diff --git a/packages/cli/src/ui/components/AuthDialog.test.tsx b/packages/cli/src/ui/components/AuthDialog.test.tsx new file mode 100644 index 00000000..a5f46d93 --- /dev/null +++ b/packages/cli/src/ui/components/AuthDialog.test.tsx @@ -0,0 +1,41 @@ +/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ + +import { render } from 'ink-testing-library'; +import { AuthDialog } from './AuthDialog.js'; +import { LoadedSettings } from '../../config/settings.js'; +import { AuthType } from '@gemini-cli/core'; + +describe('AuthDialog', () => { + it('should show an error if the initial auth type is invalid', () => { + const settings: LoadedSettings = new LoadedSettings( + { + settings: { + selectedAuthType: AuthType.USE_GEMINI, + }, + path: '', + }, + { + settings: {}, + path: '', + }, + [], + ); + + const { lastFrame } = render( + {}} + onHighlight={() => {}} + settings={settings} + initialErrorMessage="GEMINI_API_KEY environment variable not found" + />, + ); + + expect(lastFrame()).toContain( + 'GEMINI_API_KEY environment variable not found', + ); + }); +}); -- cgit v1.2.3