diff --git a/plugins/search-react/src/components/SearchFilter/SearchFilter.test.tsx b/plugins/search-react/src/components/SearchFilter/SearchFilter.test.tsx
index 736e3f3f93..d8d3b75aa2 100644
--- a/plugins/search-react/src/components/SearchFilter/SearchFilter.test.tsx
+++ b/plugins/search-react/src/components/SearchFilter/SearchFilter.test.tsx
@@ -14,14 +14,18 @@
* limitations under the License.
*/
-import { screen, render, waitFor } from '@testing-library/react';
+import { screen, waitFor } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { configApiRef } from '@backstage/core-plugin-api';
import { SearchContextProvider } from '../../context';
import { SearchFilter } from './SearchFilter';
-import { mockApis, TestApiProvider } from '@backstage/test-utils';
+import {
+ mockApis,
+ renderInTestApp,
+ TestApiProvider,
+} from '@backstage/test-utils';
import { searchApiRef } from '../../api';
describe('SearchFilter', () => {
@@ -55,14 +59,16 @@ describe('SearchFilter', () => {
it('Check that element was rendered and received props', async () => {
const CustomFilter = (props: { name: string }) =>
{props.name}
;
- render();
+ await renderInTestApp(
+ ,
+ );
expect(screen.getByRole('heading', { name })).toBeInTheDocument();
});
describe('Checkbox', () => {
it('Renders field name and values when provided as props', async () => {
- render(
+ await renderInTestApp(
{
});
it('Renders correctly based on filter state', async () => {
- render(
+ await renderInTestApp(
{
});
it('Renders correctly based on defaultValue', async () => {
- render(
+ await renderInTestApp(
{
});
it('Checking / unchecking a value sets filter state', async () => {
- render(
+ await renderInTestApp(
{
});
it('Checking / unchecking a value maintains unrelated filter state', async () => {
- render(
+ await renderInTestApp(
{
describe('Select', () => {
it('Renders field name and values when provided as props', async () => {
- render(
+ await renderInTestApp(
{
});
it('Renders values when provided asynchronously', async () => {
- render(
+ await renderInTestApp(
{
});
it('Renders correctly based on filter state', async () => {
- render(
+ await renderInTestApp(
{
});
it('Renders correctly based on defaultValue', async () => {
- render(
+ await renderInTestApp(
{
});
it('Selecting a value sets filter state', async () => {
- render(
+ await renderInTestApp(
{
});
it('Selecting a value maintains unrelated filter state', async () => {
- render(
+ await renderInTestApp(
{
});
it('Renders without exploding', async () => {
- await renderWithEffects(
+ await renderInTestApp(
{
});
it('Define default page limit options', async () => {
- await renderWithEffects(
+ await renderInTestApp(
{
it('Accept custom page limit label', async () => {
const label = 'Page limit:';
- await renderWithEffects(
+ await renderInTestApp(
{
});
it('Show the total in text', async () => {
- await renderWithEffects(
+ await renderInTestApp(
{
});
it('Accept custom page limit text', async () => {
- await renderWithEffects(
+ await renderInTestApp(
{
});
it('Accept custom page limit options', async () => {
- await renderWithEffects(
+ await renderInTestApp(
{
});
it('Set page limit in the context', async () => {
- await renderWithEffects(
+ await renderInTestApp(
{
pageCursor: 'MQ==', // page: 1
};
- await renderWithEffects(
+ await renderInTestApp(
{
pageCursor: 'Mg==', // page: 2
};
- await renderWithEffects(
+ await renderInTestApp(
{
};
it('should render as expected', async () => {
- const { getByText } = render(
+ const { getByText } = await renderInTestApp(
,
@@ -103,7 +107,7 @@ describe('SearchType.Accordion', () => {
});
it('should set entire types array when a type is selected', async () => {
- const { getByText } = render(
+ const { getByText } = await renderInTestApp(
,
@@ -115,7 +119,7 @@ describe('SearchType.Accordion', () => {
});
it('should reset types array when all is selected', async () => {
- const { getByText } = render(
+ const { getByText } = await renderInTestApp(
{
});
it('should reset page cursor when a new type is selected', async () => {
- const { getByText } = render(
+ const { getByText } = await renderInTestApp(
,
@@ -143,7 +147,7 @@ describe('SearchType.Accordion', () => {
});
it('should show result counts if enabled', async () => {
- const { getAllByText } = render(
+ const { getAllByText } = await renderInTestApp(
{
};
it('should render as expected', async () => {
- const { getByText } = render(
+ const { getByText } = await renderInTestApp(
,
@@ -85,7 +89,7 @@ describe('SearchType.Tabs', () => {
});
it('should set entire types array when a type is selected', async () => {
- const { getByText } = render(
+ const { getByText } = await renderInTestApp(
,
@@ -97,7 +101,7 @@ describe('SearchType.Tabs', () => {
});
it('should reset types array when all is selected', async () => {
- const { getByText } = render(
+ const { getByText } = await renderInTestApp(
{
});
it('should reset page cursor when a new type is selected', async () => {
- const { getByText } = render(
+ const { getByText } = await renderInTestApp(
,
diff --git a/plugins/search/src/components/SearchType/SearchType.test.tsx b/plugins/search/src/components/SearchType/SearchType.test.tsx
index fd014369f7..231463c9bf 100644
--- a/plugins/search/src/components/SearchType/SearchType.test.tsx
+++ b/plugins/search/src/components/SearchType/SearchType.test.tsx
@@ -15,14 +15,18 @@
*/
import { configApiRef } from '@backstage/core-plugin-api';
-import { render, screen, waitFor } from '@testing-library/react';
+import { screen, waitFor } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import {
SearchContextProvider,
searchApiRef,
} from '@backstage/plugin-search-react';
import { SearchType } from './SearchType';
-import { mockApis, TestApiProvider } from '@backstage/test-utils';
+import {
+ mockApis,
+ renderInTestApp,
+ TestApiProvider,
+} from '@backstage/test-utils';
describe('SearchType', () => {
const initialState = {
@@ -53,7 +57,7 @@ describe('SearchType', () => {
describe('Type Filter', () => {
it('Renders field name and values when provided as props', async () => {
- render(
+ await renderInTestApp(
{
});
it('Renders correctly based on type filter state', async () => {
- render(
+ await renderInTestApp(
{
});
it('Renders correctly based on type filter defaultValue', async () => {
- render(
+ await renderInTestApp(
{
});
it('Selecting a value sets type filter state', async () => {
- render(
+ await renderInTestApp(
{
});
it('Selecting none defaults to empty state', async () => {
- render(
+ await renderInTestApp(