replace usage of api provider and test api registry with TestApiProvider
Signed-off-by: Emma Indal <emma.indahl@gmail.com>
This commit is contained in:
@@ -10,12 +10,11 @@ import {
|
||||
MockSearchApi,
|
||||
SearchContextProvider,
|
||||
} from '@backstage/plugin-search-react';
|
||||
import { ApiProvider } from '@backstage/core-app-api';
|
||||
import { TestApiRegistry } from '@backstage/test-utils';
|
||||
import { TestApiProvider } from '@backstage/test-utils';
|
||||
|
||||
<ApiProvider apis={TestApiRegistry.from([searchApiRef, new MockSearchApi()])}>
|
||||
<TestApiProvider apis={[[searchApiRef, new MockSearchApi()]]}>
|
||||
<SearchContextProvider>
|
||||
<Component />
|
||||
</SearchContextProvider>
|
||||
</ApiProvider>;
|
||||
</TestApiProvider>;
|
||||
```
|
||||
|
||||
@@ -21,8 +21,7 @@ import {
|
||||
MockSearchApi,
|
||||
SearchContextProvider,
|
||||
} from '@backstage/plugin-search-react';
|
||||
import { ApiProvider } from '@backstage/core-app-api';
|
||||
import { TestApiRegistry } from '@backstage/test-utils';
|
||||
import { TestApiProvider } from '@backstage/test-utils';
|
||||
import { SearchBar } from './SearchBar';
|
||||
|
||||
export default {
|
||||
@@ -30,9 +29,7 @@ export default {
|
||||
component: SearchBar,
|
||||
decorators: [
|
||||
(Story: ComponentType<{}>) => (
|
||||
<ApiProvider
|
||||
apis={TestApiRegistry.from([searchApiRef, new MockSearchApi()])}
|
||||
>
|
||||
<TestApiProvider apis={[[searchApiRef, new MockSearchApi()]]}>
|
||||
<SearchContextProvider>
|
||||
<Grid container direction="row">
|
||||
<Grid item xs={12}>
|
||||
@@ -40,7 +37,7 @@ export default {
|
||||
</Grid>
|
||||
</Grid>
|
||||
</SearchContextProvider>
|
||||
</ApiProvider>
|
||||
</TestApiProvider>
|
||||
),
|
||||
],
|
||||
};
|
||||
|
||||
@@ -21,8 +21,7 @@ import {
|
||||
MockSearchApi,
|
||||
SearchContextProvider,
|
||||
} from '@backstage/plugin-search-react';
|
||||
import { ApiProvider } from '@backstage/core-app-api';
|
||||
import { TestApiRegistry } from '@backstage/test-utils';
|
||||
import { TestApiProvider } from '@backstage/test-utils';
|
||||
import { SearchFilter } from './SearchFilter';
|
||||
|
||||
export default {
|
||||
@@ -30,9 +29,7 @@ export default {
|
||||
component: SearchFilter,
|
||||
decorators: [
|
||||
(Story: ComponentType<{}>) => (
|
||||
<ApiProvider
|
||||
apis={TestApiRegistry.from([searchApiRef, new MockSearchApi()])}
|
||||
>
|
||||
<TestApiProvider apis={[[searchApiRef, new MockSearchApi()]]}>
|
||||
<SearchContextProvider>
|
||||
<Grid container direction="row">
|
||||
<Grid item xs={4}>
|
||||
@@ -40,7 +37,7 @@ export default {
|
||||
</Grid>
|
||||
</Grid>
|
||||
</SearchContextProvider>
|
||||
</ApiProvider>
|
||||
</TestApiProvider>
|
||||
),
|
||||
],
|
||||
};
|
||||
|
||||
@@ -34,8 +34,7 @@ import {
|
||||
MockSearchApi,
|
||||
SearchContextProvider,
|
||||
} from '@backstage/plugin-search-react';
|
||||
import { ApiProvider } from '@backstage/core-app-api';
|
||||
import { TestApiRegistry } from '@backstage/test-utils';
|
||||
import { TestApiProvider } from '@backstage/test-utils';
|
||||
import { SearchModal } from './SearchModal';
|
||||
import { SearchResult } from '../SearchResult';
|
||||
import { SearchResultPager } from '../SearchResultPager';
|
||||
@@ -77,16 +76,14 @@ export default {
|
||||
decorators: [
|
||||
(Story: ComponentType<{}>) =>
|
||||
wrapInTestApp(
|
||||
<ApiProvider
|
||||
apis={TestApiRegistry.from([
|
||||
searchApiRef,
|
||||
new MockSearchApi(mockResults),
|
||||
])}
|
||||
<TestApiProvider
|
||||
apis={[[searchApiRef, new MockSearchApi(mockResults)]]}
|
||||
>
|
||||
<SearchContextProvider>
|
||||
<Story />
|
||||
</SearchContextProvider>
|
||||
</ApiProvider>,
|
||||
</TestApiProvider>,
|
||||
|
||||
{ mountedRoutes: { '/search': rootRouteRef } },
|
||||
),
|
||||
],
|
||||
|
||||
@@ -26,8 +26,7 @@ import {
|
||||
SearchContextProvider,
|
||||
} from '@backstage/plugin-search-react';
|
||||
import { SearchResult } from './SearchResult';
|
||||
import { TestApiRegistry } from '@backstage/test-utils';
|
||||
import { ApiProvider } from '@backstage/core-app-api';
|
||||
import { TestApiProvider } from '@backstage/test-utils';
|
||||
|
||||
const mockResults = {
|
||||
results: [
|
||||
@@ -64,16 +63,13 @@ export default {
|
||||
decorators: [
|
||||
(Story: ComponentType<{}>) => (
|
||||
<MemoryRouter>
|
||||
<ApiProvider
|
||||
apis={TestApiRegistry.from([
|
||||
searchApiRef,
|
||||
new MockSearchApi(mockResults),
|
||||
])}
|
||||
<TestApiProvider
|
||||
apis={[[searchApiRef, new MockSearchApi(mockResults)]]}
|
||||
>
|
||||
<SearchContextProvider>
|
||||
<Story />
|
||||
</SearchContextProvider>
|
||||
</ApiProvider>
|
||||
</TestApiProvider>
|
||||
</MemoryRouter>
|
||||
),
|
||||
],
|
||||
|
||||
@@ -20,8 +20,7 @@ import DocsIcon from '@material-ui/icons/Description';
|
||||
import UsersGroupsIcon from '@material-ui/icons/Person';
|
||||
import React, { ComponentType } from 'react';
|
||||
import { SearchType } from './SearchType';
|
||||
import { ApiProvider } from '@backstage/core-app-api';
|
||||
import { TestApiRegistry } from '@backstage/test-utils';
|
||||
import { TestApiProvider } from '@backstage/test-utils';
|
||||
import {
|
||||
searchApiRef,
|
||||
MockSearchApi,
|
||||
@@ -33,9 +32,7 @@ export default {
|
||||
component: SearchType,
|
||||
decorators: [
|
||||
(Story: ComponentType<{}>) => (
|
||||
<ApiProvider
|
||||
apis={TestApiRegistry.from([searchApiRef, new MockSearchApi()])}
|
||||
>
|
||||
<TestApiProvider apis={[[searchApiRef, new MockSearchApi()]]}>
|
||||
<SearchContextProvider>
|
||||
<Grid container direction="row">
|
||||
<Grid item xs={4}>
|
||||
@@ -43,7 +40,7 @@ export default {
|
||||
</Grid>
|
||||
</Grid>
|
||||
</SearchContextProvider>
|
||||
</ApiProvider>
|
||||
</TestApiProvider>
|
||||
),
|
||||
],
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user