mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-27 13:34:15 -07:00
chore: fix test
This commit is contained in:
@@ -5,7 +5,15 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { render } from '../../test-utils/render.js';
|
import { render } from '../../test-utils/render.js';
|
||||||
import { describe, it, expect, vi, beforeEach, type Mock } from 'vitest';
|
import {
|
||||||
|
describe,
|
||||||
|
it,
|
||||||
|
expect,
|
||||||
|
vi,
|
||||||
|
beforeEach,
|
||||||
|
afterEach,
|
||||||
|
type Mock,
|
||||||
|
} from 'vitest';
|
||||||
import { LoginWithGoogleRestartDialog } from './LoginWithGoogleRestartDialog.js';
|
import { LoginWithGoogleRestartDialog } from './LoginWithGoogleRestartDialog.js';
|
||||||
import { useKeypress } from '../hooks/useKeypress.js';
|
import { useKeypress } from '../hooks/useKeypress.js';
|
||||||
import { runExitCleanup } from '../../utils/cleanup.js';
|
import { runExitCleanup } from '../../utils/cleanup.js';
|
||||||
@@ -35,13 +43,22 @@ describe('LoginWithGoogleRestartDialog', () => {
|
|||||||
|
|
||||||
const mockConfig = {
|
const mockConfig = {
|
||||||
getRemoteAdminSettings: vi.fn(),
|
getRemoteAdminSettings: vi.fn(),
|
||||||
|
getSessionId: vi.fn().mockReturnValue('mock-session-id'),
|
||||||
} as unknown as Config;
|
} as unknown as Config;
|
||||||
|
|
||||||
|
let originalSend: typeof process.send;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
vi.clearAllMocks();
|
vi.clearAllMocks();
|
||||||
exitSpy.mockClear();
|
exitSpy.mockClear();
|
||||||
vi.useRealTimers();
|
vi.useRealTimers();
|
||||||
_resetRelaunchStateForTesting();
|
_resetRelaunchStateForTesting();
|
||||||
|
originalSend = process.send;
|
||||||
|
process.send = vi.fn();
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
process.send = originalSend;
|
||||||
});
|
});
|
||||||
|
|
||||||
it('renders correctly', async () => {
|
it('renders correctly', async () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user