mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-27 13:34:15 -07:00
feat(cli): add loading state to new agents notification (#19190)
This commit is contained in:
@@ -7,6 +7,8 @@
|
||||
import { describe, it, expect, vi } from 'vitest';
|
||||
import { renderWithProviders as render } from '../../test-utils/render.js';
|
||||
import { NewAgentsNotification } from './NewAgentsNotification.js';
|
||||
import { waitFor } from '../../test-utils/async.js';
|
||||
import { act } from 'react';
|
||||
|
||||
describe('NewAgentsNotification', () => {
|
||||
const mockAgents = [
|
||||
@@ -54,4 +56,28 @@ describe('NewAgentsNotification', () => {
|
||||
expect(frame).toMatchSnapshot();
|
||||
unmount();
|
||||
});
|
||||
|
||||
it('shows processing state when an option is selected', async () => {
|
||||
const asyncOnSelect = vi.fn(
|
||||
() =>
|
||||
new Promise<void>(() => {
|
||||
// Never resolve
|
||||
}),
|
||||
);
|
||||
|
||||
const { lastFrame, stdin, unmount } = render(
|
||||
<NewAgentsNotification agents={mockAgents} onSelect={asyncOnSelect} />,
|
||||
);
|
||||
|
||||
// Press Enter to select the first option
|
||||
await act(async () => {
|
||||
stdin.write('\r');
|
||||
});
|
||||
|
||||
await waitFor(() => {
|
||||
expect(lastFrame()).toContain('Processing...');
|
||||
});
|
||||
|
||||
unmount();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user