mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-20 08:47:44 +00:00
feat: External editor settings (#882)
This commit is contained in:
@@ -15,11 +15,12 @@ import {
|
||||
TrackedExecutingToolCall,
|
||||
TrackedCancelledToolCall,
|
||||
} from './useReactToolScheduler.js';
|
||||
import { Config } from '@gemini-cli/core';
|
||||
import { Config, EditorType } from '@gemini-cli/core';
|
||||
import { Part, PartListUnion } from '@google/genai';
|
||||
import { UseHistoryManagerReturn } from './useHistoryManager.js';
|
||||
import { HistoryItem } from '../types.js';
|
||||
import { Dispatch, SetStateAction } from 'react';
|
||||
import { LoadedSettings } from '../../config/settings.js';
|
||||
|
||||
// --- MOCKS ---
|
||||
const mockSendMessageStream = vi
|
||||
@@ -309,6 +310,15 @@ describe('useGeminiStream', () => {
|
||||
.mockReturnValue((async function* () {})());
|
||||
});
|
||||
|
||||
const mockLoadedSettings: LoadedSettings = {
|
||||
merged: { preferredEditor: 'vscode' },
|
||||
user: { path: '/user/settings.json', settings: {} },
|
||||
workspace: { path: '/workspace/.gemini/settings.json', settings: {} },
|
||||
errors: [],
|
||||
forScope: vi.fn(),
|
||||
setValue: vi.fn(),
|
||||
} as unknown as LoadedSettings;
|
||||
|
||||
const renderTestHook = (
|
||||
initialToolCalls: TrackedToolCall[] = [],
|
||||
geminiClient?: any,
|
||||
@@ -337,6 +347,7 @@ describe('useGeminiStream', () => {
|
||||
| boolean
|
||||
>;
|
||||
shellModeActive: boolean;
|
||||
loadedSettings: LoadedSettings;
|
||||
}) =>
|
||||
useGeminiStream(
|
||||
props.client,
|
||||
@@ -347,6 +358,7 @@ describe('useGeminiStream', () => {
|
||||
props.onDebugMessage,
|
||||
props.handleSlashCommand,
|
||||
props.shellModeActive,
|
||||
() => 'vscode' as EditorType,
|
||||
),
|
||||
{
|
||||
initialProps: {
|
||||
@@ -363,6 +375,7 @@ describe('useGeminiStream', () => {
|
||||
| boolean
|
||||
>,
|
||||
shellModeActive: false,
|
||||
loadedSettings: mockLoadedSettings,
|
||||
},
|
||||
},
|
||||
);
|
||||
@@ -486,6 +499,7 @@ describe('useGeminiStream', () => {
|
||||
handleSlashCommand:
|
||||
mockHandleSlashCommand as unknown as typeof mockHandleSlashCommand,
|
||||
shellModeActive: false,
|
||||
loadedSettings: mockLoadedSettings,
|
||||
});
|
||||
});
|
||||
|
||||
@@ -541,6 +555,7 @@ describe('useGeminiStream', () => {
|
||||
handleSlashCommand:
|
||||
mockHandleSlashCommand as unknown as typeof mockHandleSlashCommand,
|
||||
shellModeActive: false,
|
||||
loadedSettings: mockLoadedSettings,
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user