@@ -15,8 +15,7 @@
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { wrapInTestApp } from '@backstage/test-utils';
|
||||
import { act, render } from '@testing-library/react';
|
||||
import { renderInTestApp } from '@backstage/test-utils';
|
||||
import { useNavigateToQuery } from './util';
|
||||
import { rootRouteRef } from '../plugin';
|
||||
|
||||
@@ -35,18 +34,14 @@ describe('util', () => {
|
||||
return <div>test</div>;
|
||||
};
|
||||
|
||||
await act(async () => {
|
||||
await render(
|
||||
wrapInTestApp(<MyComponent />, {
|
||||
mountedRoutes: {
|
||||
'/search': rootRouteRef,
|
||||
},
|
||||
}),
|
||||
);
|
||||
|
||||
expect(navigate).toHaveBeenCalledTimes(1);
|
||||
expect(navigate).toHaveBeenCalledWith('/search?query=test');
|
||||
await renderInTestApp(<MyComponent />, {
|
||||
mountedRoutes: {
|
||||
'/search': rootRouteRef,
|
||||
},
|
||||
});
|
||||
|
||||
expect(navigate).toHaveBeenCalled();
|
||||
expect(navigate).toHaveBeenCalledWith('/search?query=test');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user