search-react: fix search bar race

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2023-10-20 12:44:25 +02:00
parent bae9015f2b
commit f75caf9f3d
4 changed files with 28 additions and 8 deletions
@@ -15,7 +15,7 @@
*/
import React from 'react';
import { screen, waitFor } from '@testing-library/react';
import { screen } from '@testing-library/react';
import { renderInTestApp, TestApiRegistry } from '@backstage/test-utils';
import userEvent from '@testing-library/user-event';
import { configApiRef } from '@backstage/core-plugin-api';
@@ -205,7 +205,6 @@ describe('SearchModal', () => {
const input = screen.getByLabelText<HTMLInputElement>('Search');
await userEvent.clear(input);
await waitFor(() => expect(input.value).toBe(''));
await userEvent.type(input, 'new term{enter}');
expect(navigate).toHaveBeenCalledWith('/search?query=new term');