mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-20 02:51:55 -07:00
42 lines
979 B
TypeScript
42 lines
979 B
TypeScript
|
|
/**
|
||
|
|
* @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(
|
||
|
|
<AuthDialog
|
||
|
|
onSelect={() => {}}
|
||
|
|
onHighlight={() => {}}
|
||
|
|
settings={settings}
|
||
|
|
initialErrorMessage="GEMINI_API_KEY environment variable not found"
|
||
|
|
/>,
|
||
|
|
);
|
||
|
|
|
||
|
|
expect(lastFrame()).toContain(
|
||
|
|
'GEMINI_API_KEY environment variable not found',
|
||
|
|
);
|
||
|
|
});
|
||
|
|
});
|