mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-14 15:21:01 -07:00
fix: clean up /clear and /resume (#22007)
This commit is contained in:
@@ -23,6 +23,7 @@ import {
|
||||
import {
|
||||
coreEvents,
|
||||
convertSessionToClientHistory,
|
||||
uiTelemetryService,
|
||||
} from '@google/gemini-cli-core';
|
||||
|
||||
// Mock modules
|
||||
@@ -36,6 +37,17 @@ vi.mock('../../utils/sessionUtils.js', async (importOriginal) => {
|
||||
getSessionFiles: vi.fn(),
|
||||
};
|
||||
});
|
||||
vi.mock('@google/gemini-cli-core', async (importOriginal) => {
|
||||
const actual =
|
||||
await importOriginal<typeof import('@google/gemini-cli-core')>();
|
||||
return {
|
||||
...actual,
|
||||
uiTelemetryService: {
|
||||
clear: vi.fn(),
|
||||
hydrate: vi.fn(),
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
const MOCKED_PROJECT_TEMP_DIR = '/test/project/temp';
|
||||
const MOCKED_CHATS_DIR = '/test/project/temp/chats';
|
||||
@@ -102,6 +114,7 @@ describe('useSessionBrowser', () => {
|
||||
expect(mockConfig.setSessionId).toHaveBeenCalledWith(
|
||||
'existing-session-456',
|
||||
);
|
||||
expect(uiTelemetryService.hydrate).toHaveBeenCalledWith(mockConversation);
|
||||
expect(result.current.isSessionBrowserOpen).toBe(false);
|
||||
expect(mockOnLoadHistory).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
@@ -16,6 +16,7 @@ import type {
|
||||
import {
|
||||
coreEvents,
|
||||
convertSessionToClientHistory,
|
||||
uiTelemetryService,
|
||||
} from '@google/gemini-cli-core';
|
||||
import type { SessionInfo } from '../../utils/sessionUtils.js';
|
||||
import { convertSessionToHistoryFormats } from '../../utils/sessionUtils.js';
|
||||
@@ -68,6 +69,7 @@ export const useSessionBrowser = (
|
||||
// Use the old session's ID to continue it.
|
||||
const existingSessionId = conversation.sessionId;
|
||||
config.setSessionId(existingSessionId);
|
||||
uiTelemetryService.hydrate(conversation);
|
||||
|
||||
const resumedSessionData = {
|
||||
conversation,
|
||||
|
||||
Reference in New Issue
Block a user