mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-07-11 18:40:57 -07:00
fix(core): resolve nested plan directory duplication and relative path policies (#25138)
This commit is contained in:
@@ -76,6 +76,7 @@ vi.mocked(IdeClient.getInstance).mockResolvedValue(
|
||||
const fsService = new StandardFileSystemService();
|
||||
const mockConfigInternal = {
|
||||
getTargetDir: () => rootDir,
|
||||
getProjectRoot: () => rootDir,
|
||||
getApprovalMode: vi.fn(() => ApprovalMode.DEFAULT),
|
||||
setApprovalMode: vi.fn(),
|
||||
getGeminiClient: vi.fn(), // Initialize as a plain mock function
|
||||
@@ -1113,4 +1114,26 @@ describe('WriteFileTool', () => {
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('plan mode path handling', () => {
|
||||
const abortSignal = new AbortController().signal;
|
||||
|
||||
it('should correctly resolve nested paths in plan mode', async () => {
|
||||
vi.mocked(mockConfig.isPlanMode).mockReturnValue(true);
|
||||
// Extend storage mock with getPlansDir
|
||||
mockConfig.storage.getPlansDir = vi.fn().mockReturnValue(plansDir);
|
||||
|
||||
const nestedFilePath = 'conductor/tracks/test.md';
|
||||
const invocation = tool.build({
|
||||
file_path: nestedFilePath,
|
||||
content: 'nested content',
|
||||
});
|
||||
|
||||
await invocation.execute({ abortSignal });
|
||||
|
||||
const expectedWritePath = path.join(plansDir, 'conductor/tracks/test.md');
|
||||
expect(fs.existsSync(expectedWritePath)).toBe(true);
|
||||
expect(fs.readFileSync(expectedWritePath, 'utf8')).toBe('nested content');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user