mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-19 09:33:53 +00:00
Update editor.ts (#1371)
This commit is contained in:
@@ -54,7 +54,7 @@ describe('EditTool', () => {
|
|||||||
.fn()
|
.fn()
|
||||||
.mockReturnValue(mockClientInstanceWithGenerateJson),
|
.mockReturnValue(mockClientInstanceWithGenerateJson),
|
||||||
getTargetDir: () => rootDir,
|
getTargetDir: () => rootDir,
|
||||||
getApprovalMode: vi.fn(() => false),
|
getApprovalMode: vi.fn(),
|
||||||
setApprovalMode: vi.fn(),
|
setApprovalMode: vi.fn(),
|
||||||
// getGeminiConfig: () => ({ apiKey: 'test-api-key' }), // This was not a real Config method
|
// getGeminiConfig: () => ({ apiKey: 'test-api-key' }), // This was not a real Config method
|
||||||
// Add other properties/methods of Config if EditTool uses them
|
// Add other properties/methods of Config if EditTool uses them
|
||||||
@@ -79,7 +79,6 @@ describe('EditTool', () => {
|
|||||||
|
|
||||||
// Reset mocks before each test
|
// Reset mocks before each test
|
||||||
(mockConfig.getApprovalMode as Mock).mockClear();
|
(mockConfig.getApprovalMode as Mock).mockClear();
|
||||||
(mockConfig.getApprovalMode as Mock).mockClear();
|
|
||||||
// Default to not skipping confirmation
|
// Default to not skipping confirmation
|
||||||
(mockConfig.getApprovalMode as Mock).mockReturnValue(ApprovalMode.DEFAULT);
|
(mockConfig.getApprovalMode as Mock).mockReturnValue(ApprovalMode.DEFAULT);
|
||||||
|
|
||||||
@@ -335,7 +334,6 @@ describe('EditTool', () => {
|
|||||||
let mockCalled = false;
|
let mockCalled = false;
|
||||||
mockEnsureCorrectEdit.mockImplementationOnce(
|
mockEnsureCorrectEdit.mockImplementationOnce(
|
||||||
async (content, p, client) => {
|
async (content, p, client) => {
|
||||||
console.log('mockEnsureCorrectEdit CALLED IN TEST');
|
|
||||||
mockCalled = true;
|
mockCalled = true;
|
||||||
expect(content).toBe(originalContent);
|
expect(content).toBe(originalContent);
|
||||||
expect(p).toBe(params);
|
expect(p).toBe(params);
|
||||||
|
|||||||
@@ -189,6 +189,7 @@ describe('editor utils', () => {
|
|||||||
diffCommand.args,
|
diffCommand.args,
|
||||||
{
|
{
|
||||||
stdio: 'inherit',
|
stdio: 'inherit',
|
||||||
|
shell: true,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
expect(mockSpawn.on).toHaveBeenCalledWith(
|
expect(mockSpawn.on).toHaveBeenCalledWith(
|
||||||
|
|||||||
@@ -145,6 +145,7 @@ export async function openDiff(
|
|||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const childProcess = spawn(diffCommand.command, diffCommand.args, {
|
const childProcess = spawn(diffCommand.command, diffCommand.args, {
|
||||||
stdio: 'inherit',
|
stdio: 'inherit',
|
||||||
|
shell: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
childProcess.on('close', (code) => {
|
childProcess.on('close', (code) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user