mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-20 16:57:46 +00:00
feat(memory): make directory search limit on memory discovery configurable with settings.json (#4460)
This commit is contained in:
@@ -18,7 +18,6 @@ import {
|
||||
} from '../core/contentGenerator.js';
|
||||
import { GeminiClient } from '../core/client.js';
|
||||
import { GitService } from '../services/gitService.js';
|
||||
import { loadServerHierarchicalMemory } from '../utils/memoryDiscovery.js';
|
||||
|
||||
// Mock dependencies that might be called during Config construction or createServerConfig
|
||||
vi.mock('../tools/tool-registry', () => {
|
||||
@@ -313,39 +312,4 @@ describe('Server Config (config.ts)', () => {
|
||||
expect(config.getTelemetryOtlpEndpoint()).toBe(DEFAULT_OTLP_ENDPOINT);
|
||||
});
|
||||
});
|
||||
|
||||
describe('refreshMemory', () => {
|
||||
it('should update memory and file count on successful refresh', async () => {
|
||||
const config = new Config(baseParams);
|
||||
const mockMemoryData = {
|
||||
memoryContent: 'new memory content',
|
||||
fileCount: 5,
|
||||
};
|
||||
|
||||
(loadServerHierarchicalMemory as Mock).mockResolvedValue(mockMemoryData);
|
||||
|
||||
const result = await config.refreshMemory();
|
||||
|
||||
expect(loadServerHierarchicalMemory).toHaveBeenCalledWith(
|
||||
config.getWorkingDir(),
|
||||
config.getDebugMode(),
|
||||
config.getFileService(),
|
||||
config.getExtensionContextFilePaths(),
|
||||
config.getFileFilteringOptions(),
|
||||
);
|
||||
|
||||
expect(config.getUserMemory()).toBe(mockMemoryData.memoryContent);
|
||||
expect(config.getGeminiMdFileCount()).toBe(mockMemoryData.fileCount);
|
||||
expect(result).toEqual(mockMemoryData);
|
||||
});
|
||||
|
||||
it('should propagate errors from loadServerHierarchicalMemory', async () => {
|
||||
const config = new Config(baseParams);
|
||||
const testError = new Error('Failed to load memory');
|
||||
|
||||
(loadServerHierarchicalMemory as Mock).mockRejectedValue(testError);
|
||||
|
||||
await expect(config.refreshMemory()).rejects.toThrow(testError);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user