mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-11 22:00:41 -07:00
test(cli): refactor tests for async render utilities (#23252)
This commit is contained in:
committed by
GitHub
parent
86a3a913b5
commit
6c78eb7a39
@@ -33,14 +33,13 @@ describe('ConsentPrompt', () => {
|
||||
|
||||
it('renders a string prompt with MarkdownDisplay', async () => {
|
||||
const prompt = 'Are you sure?';
|
||||
const { waitUntilReady, unmount } = render(
|
||||
const { unmount } = await render(
|
||||
<ConsentPrompt
|
||||
prompt={prompt}
|
||||
onConfirm={onConfirm}
|
||||
terminalWidth={terminalWidth}
|
||||
/>,
|
||||
);
|
||||
await waitUntilReady();
|
||||
|
||||
expect(MockedMarkdownDisplay).toHaveBeenCalledWith(
|
||||
{
|
||||
@@ -55,14 +54,13 @@ describe('ConsentPrompt', () => {
|
||||
|
||||
it('renders a ReactNode prompt directly', async () => {
|
||||
const prompt = <Text>Are you sure?</Text>;
|
||||
const { lastFrame, waitUntilReady, unmount } = render(
|
||||
const { lastFrame, unmount } = await render(
|
||||
<ConsentPrompt
|
||||
prompt={prompt}
|
||||
onConfirm={onConfirm}
|
||||
terminalWidth={terminalWidth}
|
||||
/>,
|
||||
);
|
||||
await waitUntilReady();
|
||||
|
||||
expect(MockedMarkdownDisplay).not.toHaveBeenCalled();
|
||||
expect(lastFrame()).toContain('Are you sure?');
|
||||
@@ -71,14 +69,13 @@ describe('ConsentPrompt', () => {
|
||||
|
||||
it('calls onConfirm with true when "Yes" is selected', async () => {
|
||||
const prompt = 'Are you sure?';
|
||||
const { waitUntilReady, unmount } = render(
|
||||
const { waitUntilReady, unmount } = await render(
|
||||
<ConsentPrompt
|
||||
prompt={prompt}
|
||||
onConfirm={onConfirm}
|
||||
terminalWidth={terminalWidth}
|
||||
/>,
|
||||
);
|
||||
await waitUntilReady();
|
||||
|
||||
const onSelect = MockedRadioButtonSelect.mock.calls[0][0].onSelect;
|
||||
await act(async () => {
|
||||
@@ -92,14 +89,13 @@ describe('ConsentPrompt', () => {
|
||||
|
||||
it('calls onConfirm with false when "No" is selected', async () => {
|
||||
const prompt = 'Are you sure?';
|
||||
const { waitUntilReady, unmount } = render(
|
||||
const { waitUntilReady, unmount } = await render(
|
||||
<ConsentPrompt
|
||||
prompt={prompt}
|
||||
onConfirm={onConfirm}
|
||||
terminalWidth={terminalWidth}
|
||||
/>,
|
||||
);
|
||||
await waitUntilReady();
|
||||
|
||||
const onSelect = MockedRadioButtonSelect.mock.calls[0][0].onSelect;
|
||||
await act(async () => {
|
||||
@@ -113,14 +109,13 @@ describe('ConsentPrompt', () => {
|
||||
|
||||
it('passes correct items to RadioButtonSelect', async () => {
|
||||
const prompt = 'Are you sure?';
|
||||
const { waitUntilReady, unmount } = render(
|
||||
const { unmount } = await render(
|
||||
<ConsentPrompt
|
||||
prompt={prompt}
|
||||
onConfirm={onConfirm}
|
||||
terminalWidth={terminalWidth}
|
||||
/>,
|
||||
);
|
||||
await waitUntilReady();
|
||||
|
||||
expect(MockedRadioButtonSelect).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
|
||||
Reference in New Issue
Block a user