feat(cli): Add state management and plumbing for agent configuration dialog (#17259)

This commit is contained in:
Sandy Tao
2026-01-22 10:30:44 -08:00
committed by GitHub
parent ba8c64459b
commit 902e5d6dae
9 changed files with 246 additions and 1 deletions
+72
View File
@@ -28,6 +28,7 @@ import {
type UserFeedbackPayload,
type ResumedSessionData,
AuthType,
type AgentDefinition,
} from '@google/gemini-cli-core';
// Mock coreEvents
@@ -2147,6 +2148,77 @@ describe('AppContainer State Management', () => {
});
});
describe('Agent Configuration Dialog Integration', () => {
it('should initialize with dialog closed and no agent selected', async () => {
let unmount: () => void;
await act(async () => {
const result = renderAppContainer();
unmount = result.unmount;
});
await waitFor(() => expect(capturedUIState).toBeTruthy());
expect(capturedUIState.isAgentConfigDialogOpen).toBe(false);
expect(capturedUIState.selectedAgentName).toBeUndefined();
expect(capturedUIState.selectedAgentDisplayName).toBeUndefined();
expect(capturedUIState.selectedAgentDefinition).toBeUndefined();
unmount!();
});
it('should update state when openAgentConfigDialog is called', async () => {
let unmount: () => void;
await act(async () => {
const result = renderAppContainer();
unmount = result.unmount;
});
await waitFor(() => expect(capturedUIState).toBeTruthy());
const agentDefinition = { name: 'test-agent' };
act(() => {
capturedUIActions.openAgentConfigDialog(
'test-agent',
'Test Agent',
agentDefinition as unknown as AgentDefinition,
);
});
expect(capturedUIState.isAgentConfigDialogOpen).toBe(true);
expect(capturedUIState.selectedAgentName).toBe('test-agent');
expect(capturedUIState.selectedAgentDisplayName).toBe('Test Agent');
expect(capturedUIState.selectedAgentDefinition).toEqual(agentDefinition);
unmount!();
});
it('should clear state when closeAgentConfigDialog is called', async () => {
let unmount: () => void;
await act(async () => {
const result = renderAppContainer();
unmount = result.unmount;
});
await waitFor(() => expect(capturedUIState).toBeTruthy());
const agentDefinition = { name: 'test-agent' };
act(() => {
capturedUIActions.openAgentConfigDialog(
'test-agent',
'Test Agent',
agentDefinition as unknown as AgentDefinition,
);
});
expect(capturedUIState.isAgentConfigDialogOpen).toBe(true);
act(() => {
capturedUIActions.closeAgentConfigDialog();
});
expect(capturedUIState.isAgentConfigDialogOpen).toBe(false);
expect(capturedUIState.selectedAgentName).toBeUndefined();
expect(capturedUIState.selectedAgentDisplayName).toBeUndefined();
expect(capturedUIState.selectedAgentDefinition).toBeUndefined();
unmount!();
});
});
describe('CoreEvents Integration', () => {
it('subscribes to UserFeedback and drains backlog on mount', async () => {
let unmount: () => void;