mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-06-12 12:26:57 -07:00
refactor(cli): integrate real config loading into async test utils (#23040)
This commit is contained in:
committed by
GitHub
parent
7de0616229
commit
23264ced9a
@@ -79,7 +79,7 @@ describe('SearchableList', () => {
|
||||
mockOnClose = vi.fn();
|
||||
});
|
||||
|
||||
const renderList = (
|
||||
const renderList = async (
|
||||
props: Partial<SearchableListProps<GenericListItem>> = {},
|
||||
) => {
|
||||
const defaultProps: SearchableListProps<GenericListItem> = {
|
||||
@@ -95,7 +95,7 @@ describe('SearchableList', () => {
|
||||
};
|
||||
|
||||
it('should render all items initially', async () => {
|
||||
const { lastFrame, waitUntilReady } = renderList();
|
||||
const { lastFrame, waitUntilReady } = await renderList();
|
||||
await waitUntilReady();
|
||||
const frame = lastFrame();
|
||||
|
||||
@@ -109,7 +109,7 @@ describe('SearchableList', () => {
|
||||
});
|
||||
|
||||
it('should reset selection to top when items change if resetSelectionOnItemsChange is true', async () => {
|
||||
const { lastFrame, stdin, waitUntilReady } = renderList({
|
||||
const { lastFrame, stdin, waitUntilReady } = await renderList({
|
||||
resetSelectionOnItemsChange: true,
|
||||
});
|
||||
await waitUntilReady();
|
||||
@@ -150,7 +150,7 @@ describe('SearchableList', () => {
|
||||
});
|
||||
|
||||
it('should filter items based on search query', async () => {
|
||||
const { lastFrame, stdin } = renderList();
|
||||
const { lastFrame, stdin } = await renderList();
|
||||
|
||||
await React.act(async () => {
|
||||
stdin.write('Two');
|
||||
@@ -165,7 +165,7 @@ describe('SearchableList', () => {
|
||||
});
|
||||
|
||||
it('should show "No items found." when no items match', async () => {
|
||||
const { lastFrame, stdin } = renderList();
|
||||
const { lastFrame, stdin } = await renderList();
|
||||
|
||||
await React.act(async () => {
|
||||
stdin.write('xyz123');
|
||||
@@ -178,7 +178,7 @@ describe('SearchableList', () => {
|
||||
});
|
||||
|
||||
it('should handle selection with Enter', async () => {
|
||||
const { stdin } = renderList();
|
||||
const { stdin } = await renderList();
|
||||
|
||||
await React.act(async () => {
|
||||
stdin.write('\r'); // Enter
|
||||
@@ -190,7 +190,7 @@ describe('SearchableList', () => {
|
||||
});
|
||||
|
||||
it('should handle navigation and selection', async () => {
|
||||
const { stdin } = renderList();
|
||||
const { stdin } = await renderList();
|
||||
|
||||
await React.act(async () => {
|
||||
stdin.write('\u001B[B'); // Down arrow
|
||||
@@ -206,7 +206,7 @@ describe('SearchableList', () => {
|
||||
});
|
||||
|
||||
it('should handle close with Esc', async () => {
|
||||
const { stdin } = renderList();
|
||||
const { stdin } = await renderList();
|
||||
|
||||
await React.act(async () => {
|
||||
stdin.write('\u001B'); // Esc
|
||||
@@ -218,7 +218,7 @@ describe('SearchableList', () => {
|
||||
});
|
||||
|
||||
it('should match snapshot', async () => {
|
||||
const { lastFrame, waitUntilReady } = renderList();
|
||||
const { lastFrame, waitUntilReady } = await renderList();
|
||||
await waitUntilReady();
|
||||
expect(lastFrame()).toMatchSnapshot();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user