mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-19 09:33:53 +00:00
Pure refactor: Consolidate isWithinRoot() function calling. (#4163)
This commit is contained in:
committed by
GitHub
parent
e584241141
commit
fefa7ecbea
@@ -9,6 +9,7 @@ import { GrepTool, GrepToolParams } from './grep.js';
|
||||
import path from 'path';
|
||||
import fs from 'fs/promises';
|
||||
import os from 'os';
|
||||
import { Config } from '../config/config.js';
|
||||
|
||||
// Mock the child_process module to control grep/git grep behavior
|
||||
vi.mock('child_process', () => ({
|
||||
@@ -30,9 +31,13 @@ describe('GrepTool', () => {
|
||||
let grepTool: GrepTool;
|
||||
const abortSignal = new AbortController().signal;
|
||||
|
||||
const mockConfig = {
|
||||
getTargetDir: () => tempRootDir,
|
||||
} as unknown as Config;
|
||||
|
||||
beforeEach(async () => {
|
||||
tempRootDir = await fs.mkdtemp(path.join(os.tmpdir(), 'grep-tool-root-'));
|
||||
grepTool = new GrepTool(tempRootDir);
|
||||
grepTool = new GrepTool(mockConfig);
|
||||
|
||||
// Create some test files and directories
|
||||
await fs.writeFile(
|
||||
|
||||
Reference in New Issue
Block a user