mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-17 08:41:19 -07:00
test(cli): refactor tests for async render utilities (#23252)
This commit is contained in:
committed by
GitHub
parent
86a3a913b5
commit
6c78eb7a39
@@ -82,10 +82,9 @@ describe('CloudFreePrivacyNotice', () => {
|
||||
updateDataCollectionOptIn,
|
||||
});
|
||||
|
||||
const { lastFrame, waitUntilReady, unmount } = render(
|
||||
const { lastFrame, unmount } = await render(
|
||||
<CloudFreePrivacyNotice config={mockConfig} onExit={onExit} />,
|
||||
);
|
||||
await waitUntilReady();
|
||||
|
||||
expect(lastFrame()).toContain(expectedText);
|
||||
unmount();
|
||||
@@ -115,10 +114,9 @@ describe('CloudFreePrivacyNotice', () => {
|
||||
updateDataCollectionOptIn,
|
||||
});
|
||||
|
||||
const { waitUntilReady, unmount } = render(
|
||||
const { waitUntilReady, unmount } = await render(
|
||||
<CloudFreePrivacyNotice config={mockConfig} onExit={onExit} />,
|
||||
);
|
||||
await waitUntilReady();
|
||||
|
||||
const keypressHandler = mockedUseKeypress.mock.calls[0][0];
|
||||
await act(async () => {
|
||||
@@ -145,10 +143,9 @@ describe('CloudFreePrivacyNotice', () => {
|
||||
])(
|
||||
'calls correct functions on selecting "$label"',
|
||||
async ({ selection }) => {
|
||||
const { waitUntilReady, unmount } = render(
|
||||
const { waitUntilReady, unmount } = await render(
|
||||
<CloudFreePrivacyNotice config={mockConfig} onExit={onExit} />,
|
||||
);
|
||||
await waitUntilReady();
|
||||
|
||||
const onSelectHandler =
|
||||
mockedRadioButtonSelect.mock.calls[0][0].onSelect;
|
||||
|
||||
@@ -25,10 +25,9 @@ describe('CloudPaidPrivacyNotice', () => {
|
||||
});
|
||||
|
||||
it('renders correctly', async () => {
|
||||
const { lastFrame, waitUntilReady, unmount } = render(
|
||||
const { lastFrame, unmount } = await render(
|
||||
<CloudPaidPrivacyNotice onExit={onExit} />,
|
||||
);
|
||||
await waitUntilReady();
|
||||
|
||||
expect(lastFrame()).toContain('Vertex AI Notice');
|
||||
expect(lastFrame()).toContain('Service Specific Terms');
|
||||
@@ -37,10 +36,9 @@ describe('CloudPaidPrivacyNotice', () => {
|
||||
});
|
||||
|
||||
it('exits on Escape', async () => {
|
||||
const { waitUntilReady, unmount } = render(
|
||||
const { waitUntilReady, unmount } = await render(
|
||||
<CloudPaidPrivacyNotice onExit={onExit} />,
|
||||
);
|
||||
await waitUntilReady();
|
||||
|
||||
const keypressHandler = mockedUseKeypress.mock.calls[0][0];
|
||||
await act(async () => {
|
||||
|
||||
@@ -25,10 +25,9 @@ describe('GeminiPrivacyNotice', () => {
|
||||
});
|
||||
|
||||
it('renders correctly', async () => {
|
||||
const { lastFrame, waitUntilReady, unmount } = render(
|
||||
const { lastFrame, unmount } = await render(
|
||||
<GeminiPrivacyNotice onExit={onExit} />,
|
||||
);
|
||||
await waitUntilReady();
|
||||
|
||||
expect(lastFrame()).toContain('Gemini API Key Notice');
|
||||
expect(lastFrame()).toContain('By using the Gemini API');
|
||||
@@ -37,10 +36,9 @@ describe('GeminiPrivacyNotice', () => {
|
||||
});
|
||||
|
||||
it('exits on Escape', async () => {
|
||||
const { waitUntilReady, unmount } = render(
|
||||
const { waitUntilReady, unmount } = await render(
|
||||
<GeminiPrivacyNotice onExit={onExit} />,
|
||||
);
|
||||
await waitUntilReady();
|
||||
|
||||
const keypressHandler = mockedUseKeypress.mock.calls[0][0];
|
||||
await act(async () => {
|
||||
|
||||
@@ -69,10 +69,9 @@ describe('PrivacyNotice', () => {
|
||||
authType,
|
||||
} as unknown as ContentGeneratorConfig);
|
||||
|
||||
const { lastFrame, waitUntilReady, unmount } = render(
|
||||
const { lastFrame, unmount } = await render(
|
||||
<PrivacyNotice config={mockConfig} onExit={onExit} />,
|
||||
);
|
||||
await waitUntilReady();
|
||||
|
||||
expect(lastFrame()).toContain(expectedComponent);
|
||||
unmount();
|
||||
|
||||
Reference in New Issue
Block a user