mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-29 14:34:55 -07:00
chore: use waitFor rather than wait (#11616)
This commit is contained in:
@@ -1837,13 +1837,14 @@ describe('InputPrompt', () => {
|
|||||||
act(() => {
|
act(() => {
|
||||||
stdin.write('\x12');
|
stdin.write('\x12');
|
||||||
});
|
});
|
||||||
await wait();
|
|
||||||
|
|
||||||
const frame = stdout.lastFrame();
|
await waitFor(() => {
|
||||||
expect(frame).toContain('(r:)');
|
const frame = stdout.lastFrame();
|
||||||
expect(frame).toContain('echo hello');
|
expect(frame).toContain('(r:)');
|
||||||
expect(frame).toContain('echo world');
|
expect(frame).toContain('echo hello');
|
||||||
expect(frame).toContain('ls');
|
expect(frame).toContain('echo world');
|
||||||
|
expect(frame).toContain('ls');
|
||||||
|
});
|
||||||
|
|
||||||
unmount();
|
unmount();
|
||||||
});
|
});
|
||||||
@@ -1898,10 +1899,11 @@ describe('InputPrompt', () => {
|
|||||||
act(() => {
|
act(() => {
|
||||||
stdin.write('\x12');
|
stdin.write('\x12');
|
||||||
});
|
});
|
||||||
await wait();
|
|
||||||
|
|
||||||
// Verify reverse search is active
|
// Verify reverse search is active
|
||||||
expect(stdout.lastFrame()).toContain('(r:)');
|
await waitFor(() => {
|
||||||
|
expect(stdout.lastFrame()).toContain('(r:)');
|
||||||
|
});
|
||||||
|
|
||||||
// Press Tab to complete the highlighted entry
|
// Press Tab to complete the highlighted entry
|
||||||
act(() => {
|
act(() => {
|
||||||
@@ -1934,9 +1936,10 @@ describe('InputPrompt', () => {
|
|||||||
act(() => {
|
act(() => {
|
||||||
stdin.write('\x12');
|
stdin.write('\x12');
|
||||||
});
|
});
|
||||||
await wait();
|
|
||||||
|
|
||||||
expect(stdout.lastFrame()).toContain('(r:)');
|
await waitFor(() => {
|
||||||
|
expect(stdout.lastFrame()).toContain('(r:)');
|
||||||
|
});
|
||||||
|
|
||||||
act(() => {
|
act(() => {
|
||||||
stdin.write('\r');
|
stdin.write('\r');
|
||||||
@@ -1958,7 +1961,6 @@ describe('InputPrompt', () => {
|
|||||||
props.buffer.cursor = initialCursor;
|
props.buffer.cursor = initialCursor;
|
||||||
|
|
||||||
// Mock the reverse search completion to be active and then reset
|
// Mock the reverse search completion to be active and then reset
|
||||||
const mockResetCompletionState = vi.fn();
|
|
||||||
mockedUseReverseSearchCompletion.mockImplementation(
|
mockedUseReverseSearchCompletion.mockImplementation(
|
||||||
(buffer, shellHistory, reverseSearchActiveFromInputPrompt) => ({
|
(buffer, shellHistory, reverseSearchActiveFromInputPrompt) => ({
|
||||||
...mockReverseSearchCompletion,
|
...mockReverseSearchCompletion,
|
||||||
@@ -1966,7 +1968,6 @@ describe('InputPrompt', () => {
|
|||||||
? [{ label: 'history item', value: 'history item' }]
|
? [{ label: 'history item', value: 'history item' }]
|
||||||
: [],
|
: [],
|
||||||
showSuggestions: reverseSearchActiveFromInputPrompt,
|
showSuggestions: reverseSearchActiveFromInputPrompt,
|
||||||
resetCompletionState: mockResetCompletionState,
|
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -1979,9 +1980,10 @@ describe('InputPrompt', () => {
|
|||||||
act(() => {
|
act(() => {
|
||||||
stdin.write('\x12');
|
stdin.write('\x12');
|
||||||
});
|
});
|
||||||
await wait();
|
|
||||||
|
|
||||||
expect(stdout.lastFrame()).toContain('(r:)');
|
await waitFor(() => {
|
||||||
|
expect(stdout.lastFrame()).toContain('(r:)');
|
||||||
|
});
|
||||||
|
|
||||||
// Press kitty escape key
|
// Press kitty escape key
|
||||||
act(() => {
|
act(() => {
|
||||||
@@ -1990,12 +1992,10 @@ describe('InputPrompt', () => {
|
|||||||
|
|
||||||
await waitFor(() => {
|
await waitFor(() => {
|
||||||
expect(stdout.lastFrame()).not.toContain('(r:)');
|
expect(stdout.lastFrame()).not.toContain('(r:)');
|
||||||
expect(mockResetCompletionState).toHaveBeenCalled();
|
expect(props.buffer.text).toBe(initialText);
|
||||||
|
expect(props.buffer.cursor).toEqual(initialCursor);
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(props.buffer.text).toBe(initialText);
|
|
||||||
expect(props.buffer.cursor).toEqual(initialCursor);
|
|
||||||
|
|
||||||
unmount();
|
unmount();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user