mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-21 17:27:54 +00:00
Sync upstream Gemini-CLI v0.8.2 (#838)
This commit is contained in:
@@ -10,8 +10,20 @@ import { type CommandContext } from './types.js';
|
||||
import { createMockCommandContext } from '../../test-utils/mockCommandContext.js';
|
||||
import * as versionUtils from '../../utils/version.js';
|
||||
import { MessageType } from '../types.js';
|
||||
import { IdeClient } from '@qwen-code/qwen-code-core';
|
||||
|
||||
import type { IdeClient } from '../../../../core/src/ide/ide-client.js';
|
||||
vi.mock('@qwen-code/qwen-code-core', async (importOriginal) => {
|
||||
const actual =
|
||||
await importOriginal<typeof import('@qwen-code/qwen-code-core')>();
|
||||
return {
|
||||
...actual,
|
||||
IdeClient: {
|
||||
getInstance: vi.fn().mockResolvedValue({
|
||||
getDetectedIdeDisplayName: vi.fn().mockReturnValue('test-ide'),
|
||||
}),
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
vi.mock('../../utils/version.js', () => ({
|
||||
getCliVersion: vi.fn(),
|
||||
@@ -27,7 +39,6 @@ describe('aboutCommand', () => {
|
||||
services: {
|
||||
config: {
|
||||
getModel: vi.fn(),
|
||||
getIdeClient: vi.fn(),
|
||||
getIdeMode: vi.fn().mockReturnValue(true),
|
||||
},
|
||||
settings: {
|
||||
@@ -53,9 +64,6 @@ describe('aboutCommand', () => {
|
||||
Object.defineProperty(process, 'platform', {
|
||||
value: 'test-os',
|
||||
});
|
||||
vi.spyOn(mockContext.services.config!, 'getIdeClient').mockReturnValue({
|
||||
getDetectedIdeDisplayName: vi.fn().mockReturnValue('test-ide'),
|
||||
} as Partial<IdeClient> as IdeClient);
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
@@ -129,9 +137,9 @@ describe('aboutCommand', () => {
|
||||
});
|
||||
|
||||
it('should not show ide client when it is not detected', async () => {
|
||||
vi.spyOn(mockContext.services.config!, 'getIdeClient').mockReturnValue({
|
||||
vi.mocked(IdeClient.getInstance).mockResolvedValue({
|
||||
getDetectedIdeDisplayName: vi.fn().mockReturnValue(undefined),
|
||||
} as Partial<IdeClient> as IdeClient);
|
||||
} as unknown as IdeClient);
|
||||
|
||||
process.env['SANDBOX'] = '';
|
||||
if (!aboutCommand.action) {
|
||||
|
||||
Reference in New Issue
Block a user