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
@@ -54,7 +54,7 @@ export class TestApiRegistry implements ApiHolder {
*
* @example
* ```ts
* const apis = TestApiRegistry.with(
* const apis = TestApiRegistry.from(
* [configApiRef, new ConfigReader({})],
* [identityApiRef, { getUserId: () => 'tester' }],
* );
@@ -14,7 +14,6 @@
* limitations under the License.
*/
import { ApiProvider, ApiRegistry } from '@backstage/core-app-api';
import {
createExternalRouteRef,
createRouteRef,
@@ -29,6 +28,7 @@ import React, { useEffect } from 'react';
import { Route, Routes } from 'react-router';
import { MockErrorApi } from './apis';
import { renderInTestApp, wrapInTestApp } from './appWrappers';
import { TestApiProvider } from './TestApiProvider';
describe('wrapInTestApp', () => {
it('should provide routing and warn about missing act()', async () => {
@@ -111,9 +111,9 @@ describe('wrapInTestApp', () => {
};
const rendered = await renderInTestApp(
<ApiProvider apis={ApiRegistry.with(errorApiRef, mockErrorApi)}>
<TestApiProvider apis={[[errorApiRef, mockErrorApi]]}>
<A />
</ApiProvider>,
</TestApiProvider>,
);
expect(rendered.getByText('foo')).toBeInTheDocument();