From fefa7ecbea2ab985e48679ceb3010a174777a188 Mon Sep 17 00:00:00 2001 From: Tommaso Sciortino Date: Mon, 14 Jul 2025 22:55:49 -0700 Subject: Pure refactor: Consolidate isWithinRoot() function calling. (#4163) --- packages/core/src/tools/glob.test.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'packages/core/src/tools/glob.test.ts') diff --git a/packages/core/src/tools/glob.test.ts b/packages/core/src/tools/glob.test.ts index acda3729..c63b41cc 100644 --- a/packages/core/src/tools/glob.test.ts +++ b/packages/core/src/tools/glob.test.ts @@ -22,12 +22,13 @@ describe('GlobTool', () => { const mockConfig = { getFileService: () => new FileDiscoveryService(tempRootDir), getFileFilteringRespectGitIgnore: () => true, - } as Partial as Config; + getTargetDir: () => tempRootDir, + } as unknown as Config; beforeEach(async () => { // Create a unique root directory for each test run tempRootDir = await fs.mkdtemp(path.join(os.tmpdir(), 'glob-tool-root-')); - globTool = new GlobTool(tempRootDir, mockConfig); + globTool = new GlobTool(mockConfig); // Create some test files and directories within this root // Top-level files @@ -224,8 +225,8 @@ describe('GlobTool', () => { it("should return error if search path resolves outside the tool's root directory", () => { // Create a globTool instance specifically for this test, with a deeper root - const deeperRootDir = path.join(tempRootDir, 'sub'); - const specificGlobTool = new GlobTool(deeperRootDir, mockConfig); + tempRootDir = path.join(tempRootDir, 'sub'); + const specificGlobTool = new GlobTool(mockConfig); // const params: GlobToolParams = { pattern: '*.txt', path: '..' }; // This line is unused and will be removed. // This should be fine as tempRootDir is still within the original tempRootDir (the parent of deeperRootDir) // Let's try to go further up. -- cgit v1.2.3