dev-utils,test-utils,app: update to use app-defaults

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2021-10-28 15:31:59 +02:00
parent 1c3413bab0
commit 0fb57d28e3
5 changed files with 81 additions and 60 deletions
@@ -18,7 +18,7 @@ import React, { ComponentType, ReactNode, ReactElement } from 'react';
import { MemoryRouter } from 'react-router';
import { Route } from 'react-router-dom';
import { lightTheme } from '@backstage/theme';
import { createApp } from '@backstage/core-app-api';
import { createSpecializedApp } from '@backstage/core-app-api';
import {
BootErrorPageProps,
RouteRef,
@@ -30,6 +30,28 @@ import { RenderResult } from '@testing-library/react';
import { renderWithEffects } from './testingLibrary';
import { mockApis } from './mockApis';
const mockIcons = {
'kind:api': () => <span />,
'kind:component': () => <span />,
'kind:domain': () => <span />,
'kind:group': () => <span />,
'kind:location': () => <span />,
'kind:system': () => <span />,
'kind:user': () => <span />,
brokenImage: () => <span />,
catalog: () => <span />,
chat: () => <span />,
dashboard: () => <span />,
docs: () => <span />,
email: () => <span />,
github: () => <span />,
group: () => <span />,
help: () => <span />,
user: () => <span />,
warning: () => <span />,
};
const ErrorBoundaryFallback = ({ error }: { error: Error }) => {
throw new Error(`Reached ErrorBoundaryFallback Page with error, ${error}`);
};
@@ -90,7 +112,7 @@ export function wrapInTestApp(
const { routeEntries = ['/'] } = options;
const boundRoutes = new Map<ExternalRouteRef, RouteRef>();
const app = createApp({
const app = createSpecializedApp({
apis: mockApis,
// Bit of a hack to make sure that the default config loader isn't used
// as that would force every single test to wait for config loading.
@@ -104,6 +126,7 @@ export function wrapInTestApp(
<MemoryRouter initialEntries={routeEntries} children={children} />
),
},
icons: mockIcons,
plugins: [],
themes: [
{