mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-10 22:21:22 -07:00
Fix tests (#14458)
This commit is contained in:
committed by
GitHub
parent
8d4082ef2e
commit
00705b14bd
@@ -24,6 +24,10 @@ vi.mock('ink', async () => {
|
||||
};
|
||||
});
|
||||
|
||||
vi.mock('./CliSpinner.js', () => ({
|
||||
CliSpinner: () => 'Spinner',
|
||||
}));
|
||||
|
||||
describe('GeminiRespondingSpinner', () => {
|
||||
const mockUseStreamingContext = vi.mocked(useStreamingContext);
|
||||
const mockUseIsScreenReaderEnabled = vi.mocked(useIsScreenReaderEnabled);
|
||||
|
||||
@@ -33,6 +33,9 @@ describe('sandboxUtils', () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
process.env = { ...originalEnv };
|
||||
// Clean up these env vars that might affect tests
|
||||
delete process.env['NODE_ENV'];
|
||||
delete process.env['DEBUG'];
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
|
||||
import { getCliVersion } from './version.js';
|
||||
import * as core from '@google/gemini-cli-core';
|
||||
import { getPackageJson } from '@google/gemini-cli-core';
|
||||
|
||||
vi.mock('@google/gemini-cli-core', () => ({
|
||||
getPackageJson: vi.fn(),
|
||||
@@ -18,7 +18,7 @@ describe('version', () => {
|
||||
beforeEach(() => {
|
||||
vi.resetModules();
|
||||
process.env = { ...originalEnv };
|
||||
vi.mocked(core.getPackageJson).mockResolvedValue({ version: '1.0.0' });
|
||||
vi.mocked(getPackageJson).mockResolvedValue({ version: '1.0.0' });
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
@@ -39,7 +39,7 @@ describe('version', () => {
|
||||
|
||||
it('should return "unknown" if package.json is not found and CLI_VERSION is not set', async () => {
|
||||
delete process.env['CLI_VERSION'];
|
||||
vi.mocked(core.getPackageJson).mockResolvedValue(undefined);
|
||||
vi.mocked(getPackageJson).mockResolvedValue(undefined);
|
||||
const version = await getCliVersion();
|
||||
expect(version).toBe('unknown');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user