chore: Extract '.gemini' to GEMINI_DIR constant (#10540)

Co-authored-by: Richie Foreman <richie.foreman@gmail.com>
This commit is contained in:
Dongin Kim(Terry)
2025-10-14 02:31:39 +09:00
committed by GitHub
parent 7beaa368a9
commit 518caae62e
36 changed files with 181 additions and 157 deletions

View File

@@ -18,6 +18,7 @@ import * as path from 'node:path';
import * as os from 'node:os';
import { ToolConfirmationOutcome } from './tools.js';
import { ToolErrorType } from './tool-error.js';
import { GEMINI_DIR } from '../utils/paths.js';
// Mock dependencies
vi.mock(import('node:fs/promises'), async (importOriginal) => {
@@ -105,7 +106,7 @@ describe('MemoryTool', () => {
beforeEach(() => {
testFilePath = path.join(
os.homedir(),
'.gemini',
GEMINI_DIR,
DEFAULT_CONTEXT_FILENAME,
);
});
@@ -237,7 +238,7 @@ describe('MemoryTool', () => {
// Use getCurrentGeminiMdFilename for the default expectation before any setGeminiMdFilename calls in a test
const expectedFilePath = path.join(
os.homedir(),
'.gemini',
GEMINI_DIR,
getCurrentGeminiMdFilename(), // This will be DEFAULT_CONTEXT_FILENAME unless changed by a test
);
@@ -317,9 +318,11 @@ describe('MemoryTool', () => {
expect(result).not.toBe(false);
if (result && result.type === 'edit') {
const expectedPath = path.join('~', '.gemini', 'GEMINI.md');
const expectedPath = path.join('~', GEMINI_DIR, 'GEMINI.md');
expect(result.title).toBe(`Confirm Memory Save: ${expectedPath}`);
expect(result.fileName).toContain(path.join('mock', 'home', '.gemini'));
expect(result.fileName).toContain(
path.join('mock', 'home', GEMINI_DIR),
);
expect(result.fileName).toContain('GEMINI.md');
expect(result.fileDiff).toContain('Index: GEMINI.md');
expect(result.fileDiff).toContain('+## Gemini Added Memories');
@@ -334,7 +337,7 @@ describe('MemoryTool', () => {
const params = { fact: 'Test fact' };
const memoryFilePath = path.join(
os.homedir(),
'.gemini',
GEMINI_DIR,
getCurrentGeminiMdFilename(),
);
@@ -352,7 +355,7 @@ describe('MemoryTool', () => {
const params = { fact: 'Test fact' };
const memoryFilePath = path.join(
os.homedir(),
'.gemini',
GEMINI_DIR,
getCurrentGeminiMdFilename(),
);
@@ -378,7 +381,7 @@ describe('MemoryTool', () => {
const params = { fact: 'Test fact' };
const memoryFilePath = path.join(
os.homedir(),
'.gemini',
GEMINI_DIR,
getCurrentGeminiMdFilename(),
);
@@ -415,7 +418,7 @@ describe('MemoryTool', () => {
expect(result).not.toBe(false);
if (result && result.type === 'edit') {
const expectedPath = path.join('~', '.gemini', 'GEMINI.md');
const expectedPath = path.join('~', GEMINI_DIR, 'GEMINI.md');
expect(result.title).toBe(`Confirm Memory Save: ${expectedPath}`);
expect(result.fileDiff).toContain('Index: GEMINI.md');
expect(result.fileDiff).toContain('+- New fact');