@@ -15,8 +15,12 @@
|
||||
*/
|
||||
|
||||
import { ReactNode } from 'react';
|
||||
import { mockApis, TestApiProvider } from '@backstage/test-utils';
|
||||
import { act, render, waitFor } from '@testing-library/react';
|
||||
import {
|
||||
mockApis,
|
||||
renderInTestApp,
|
||||
TestApiProvider,
|
||||
} from '@backstage/test-utils';
|
||||
import { act, waitFor } from '@testing-library/react';
|
||||
import user from '@testing-library/user-event';
|
||||
import {
|
||||
searchApiRef,
|
||||
@@ -81,7 +85,7 @@ describe('SearchType.Accordion', () => {
|
||||
};
|
||||
|
||||
it('should render as expected', async () => {
|
||||
const { getByText } = render(
|
||||
const { getByText } = await renderInTestApp(
|
||||
<Wrapper>
|
||||
<SearchType.Accordion name={expectedLabel} types={[expectedType]} />
|
||||
</Wrapper>,
|
||||
@@ -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(
|
||||
<Wrapper>
|
||||
<SearchType.Accordion name={expectedLabel} types={[expectedType]} />
|
||||
</Wrapper>,
|
||||
@@ -115,7 +119,7 @@ describe('SearchType.Accordion', () => {
|
||||
});
|
||||
|
||||
it('should reset types array when all is selected', async () => {
|
||||
const { getByText } = render(
|
||||
const { getByText } = await renderInTestApp(
|
||||
<Wrapper>
|
||||
<SearchType.Accordion
|
||||
name={expectedLabel}
|
||||
@@ -131,7 +135,7 @@ describe('SearchType.Accordion', () => {
|
||||
});
|
||||
|
||||
it('should reset page cursor when a new type is selected', async () => {
|
||||
const { getByText } = render(
|
||||
const { getByText } = await renderInTestApp(
|
||||
<Wrapper>
|
||||
<SearchType.Accordion name={expectedLabel} types={[expectedType]} />
|
||||
</Wrapper>,
|
||||
@@ -143,7 +147,7 @@ describe('SearchType.Accordion', () => {
|
||||
});
|
||||
|
||||
it('should show result counts if enabled', async () => {
|
||||
const { getAllByText } = render(
|
||||
const { getAllByText } = await renderInTestApp(
|
||||
<Wrapper>
|
||||
<SearchType.Accordion
|
||||
name={expectedLabel}
|
||||
|
||||
@@ -15,8 +15,12 @@
|
||||
*/
|
||||
|
||||
import { ReactNode } from 'react';
|
||||
import { mockApis, TestApiProvider } from '@backstage/test-utils';
|
||||
import { act, render } from '@testing-library/react';
|
||||
import {
|
||||
mockApis,
|
||||
renderInTestApp,
|
||||
TestApiProvider,
|
||||
} from '@backstage/test-utils';
|
||||
import { act } from '@testing-library/react';
|
||||
import user from '@testing-library/user-event';
|
||||
import {
|
||||
SearchContextProvider,
|
||||
@@ -69,7 +73,7 @@ describe('SearchType.Tabs', () => {
|
||||
};
|
||||
|
||||
it('should render as expected', async () => {
|
||||
const { getByText } = render(
|
||||
const { getByText } = await renderInTestApp(
|
||||
<Wrapper>
|
||||
<SearchType.Tabs types={[expectedType]} />
|
||||
</Wrapper>,
|
||||
@@ -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(
|
||||
<Wrapper>
|
||||
<SearchType.Tabs types={[expectedType]} />
|
||||
</Wrapper>,
|
||||
@@ -97,7 +101,7 @@ describe('SearchType.Tabs', () => {
|
||||
});
|
||||
|
||||
it('should reset types array when all is selected', async () => {
|
||||
const { getByText } = render(
|
||||
const { getByText } = await renderInTestApp(
|
||||
<Wrapper>
|
||||
<SearchType.Tabs
|
||||
defaultValue={expectedType.value}
|
||||
@@ -112,7 +116,7 @@ describe('SearchType.Tabs', () => {
|
||||
});
|
||||
|
||||
it('should reset page cursor when a new type is selected', async () => {
|
||||
const { getByText } = render(
|
||||
const { getByText } = await renderInTestApp(
|
||||
<Wrapper>
|
||||
<SearchType.Tabs types={[expectedType]} />
|
||||
</Wrapper>,
|
||||
|
||||
@@ -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(
|
||||
<TestApiProvider
|
||||
apis={[
|
||||
[configApiRef, configApiMock],
|
||||
@@ -85,7 +89,7 @@ describe('SearchType', () => {
|
||||
});
|
||||
|
||||
it('Renders correctly based on type filter state', async () => {
|
||||
render(
|
||||
await renderInTestApp(
|
||||
<TestApiProvider
|
||||
apis={[
|
||||
[configApiRef, configApiMock],
|
||||
@@ -123,7 +127,7 @@ describe('SearchType', () => {
|
||||
});
|
||||
|
||||
it('Renders correctly based on type filter defaultValue', async () => {
|
||||
render(
|
||||
await renderInTestApp(
|
||||
<TestApiProvider
|
||||
apis={[
|
||||
[configApiRef, configApiMock],
|
||||
@@ -156,7 +160,7 @@ describe('SearchType', () => {
|
||||
});
|
||||
|
||||
it('Selecting a value sets type filter state', async () => {
|
||||
render(
|
||||
await renderInTestApp(
|
||||
<TestApiProvider
|
||||
apis={[
|
||||
[configApiRef, configApiMock],
|
||||
@@ -199,7 +203,7 @@ describe('SearchType', () => {
|
||||
});
|
||||
|
||||
it('Selecting none defaults to empty state', async () => {
|
||||
render(
|
||||
await renderInTestApp(
|
||||
<TestApiProvider
|
||||
apis={[
|
||||
[configApiRef, configApiMock],
|
||||
|
||||
Reference in New Issue
Block a user