packages,plugins: migrate to using TestApiProvider and Registry

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2021-11-17 18:56:22 +01:00
parent 7ff56c2330
commit 29ef695410
118 changed files with 991 additions and 1112 deletions
@@ -24,16 +24,13 @@ import { useWorkflowRuns } from '../useWorkflowRuns';
import type { Props as RecentWorkflowRunsCardProps } from './RecentWorkflowRunsCard';
import { RecentWorkflowRunsCard } from './RecentWorkflowRunsCard';
import {
ApiProvider,
ApiRegistry,
ConfigReader,
} from '@backstage/core-app-api';
import { ConfigReader } from '@backstage/core-app-api';
import {
errorApiRef,
configApiRef,
ConfigApi,
} from '@backstage/core-plugin-api';
import { TestApiProvider } from '@backstage/test-utils';
jest.mock('../useWorkflowRuns', () => ({
useWorkflowRuns: jest.fn(),
@@ -82,16 +79,16 @@ describe('<RecentWorkflowRunsCard />', () => {
render(
<ThemeProvider theme={lightTheme}>
<MemoryRouter>
<ApiProvider
apis={ApiRegistry.with(errorApiRef, mockErrorApi).with(
configApiRef,
configApi,
)}
<TestApiProvider
apis={[
[errorApiRef, mockErrorApi],
[configApiRef, configApi],
]}
>
<EntityProvider entity={props.entity!}>
<RecentWorkflowRunsCard {...props} />
</EntityProvider>
</ApiProvider>
</TestApiProvider>
</MemoryRouter>
</ThemeProvider>,
);