diff options
| author | matt korwel <[email protected]> | 2025-06-11 13:34:35 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-06-11 20:34:35 +0000 |
| commit | 4160d904da8328eb7168b5b652d4c0f17682546c (patch) | |
| tree | d73968337c4b1f241ab2165f40bafe7fbbd6cea8 /packages/cli/src/config/config.test.ts | |
| parent | 24c61147b839b3173fa1ad79781f3c4c0f4144fa (diff) | |
Extensibility: Gemini.md files (#944)
Diffstat (limited to 'packages/cli/src/config/config.test.ts')
| -rw-r--r-- | packages/cli/src/config/config.test.ts | 41 |
1 files changed, 30 insertions, 11 deletions
diff --git a/packages/cli/src/config/config.test.ts b/packages/cli/src/config/config.test.ts index 269b4c81..b8c617bb 100644 --- a/packages/cli/src/config/config.test.ts +++ b/packages/cli/src/config/config.test.ts @@ -58,8 +58,11 @@ vi.mock('@gemini-cli/core', async () => { setUserMemory: vi.fn(), setGeminiMdFileCount: vi.fn(), })), - loadServerHierarchicalMemory: vi.fn(() => - Promise.resolve({ memoryContent: '', fileCount: 0 }), + loadServerHierarchicalMemory: vi.fn((cwd, debug, extensionPaths) => + Promise.resolve({ + memoryContent: extensionPaths?.join(',') || '', + fileCount: extensionPaths?.length || 0, + }), ), }; }); @@ -228,15 +231,31 @@ describe('Hierarchical Memory Loading (config.ts) - Placeholder Suite', () => { vi.restoreAllMocks(); }); - it('should have a placeholder test to ensure test file validity', () => { - // This test suite is currently a placeholder. - // Tests for loadHierarchicalGeminiMemory were removed due to persistent - // and complex mocking issues with Node.js built-in modules (like 'os') - // in the Vitest environment. These issues prevented consistent and reliable - // testing of file system interactions dependent on os.homedir(). - // The core logic was implemented as per specification, but the tests - // could not be stabilized. - expect(true).toBe(true); + it('should pass extension context file paths to loadServerHierarchicalMemory', async () => { + process.argv = ['node', 'script.js']; + const settings: Settings = {}; + const extensions = [ + { + name: 'ext1', + version: '1.0.0', + contextFileName: '/path/to/ext1/gemini.md', + }, + { + name: 'ext2', + version: '1.0.0', + }, + { + name: 'ext3', + version: '1.0.0', + contextFileName: '/path/to/ext3/gemini.md', + }, + ]; + await loadCliConfig(settings, extensions, [], 'session-id'); + expect(ServerConfig.loadServerHierarchicalMemory).toHaveBeenCalledWith( + expect.any(String), + false, + ['/path/to/ext1/gemini.md', '/path/to/ext3/gemini.md'], + ); }); // NOTE TO FUTURE DEVELOPERS: |
