test-utils: migrate theme usage and switch to actual MUI icons

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2021-11-10 18:50:22 +01:00
parent 1be02e09dc
commit 46570fecbc
2 changed files with 30 additions and 22 deletions
@@ -18,6 +18,9 @@ import React, { ComponentType, ReactNode, ReactElement } from 'react';
import { MemoryRouter } from 'react-router';
import { Route } from 'react-router-dom';
import { lightTheme } from '@backstage/theme';
import { ThemeProvider } from '@material-ui/core/styles';
import { CssBaseline } from '@material-ui/core';
import MockIcon from '@material-ui/icons/AcUnit';
import { createSpecializedApp } from '@backstage/core-app-api';
import {
BootErrorPageProps,
@@ -32,28 +35,28 @@ import { defaultApis } from './defaultApis';
import { mockApis } from './mockApis';
const mockIcons = {
'kind:api': () => <svg />,
'kind:component': () => <svg />,
'kind:domain': () => <svg />,
'kind:group': () => <svg />,
'kind:location': () => <svg />,
'kind:system': () => <svg />,
'kind:user': () => <svg />,
'kind:api': MockIcon,
'kind:component': MockIcon,
'kind:domain': MockIcon,
'kind:group': MockIcon,
'kind:location': MockIcon,
'kind:system': MockIcon,
'kind:user': MockIcon,
brokenImage: () => <svg />,
catalog: () => <svg />,
scaffolder: () => <svg />,
techdocs: () => <svg />,
search: () => <svg />,
chat: () => <svg />,
dashboard: () => <svg />,
docs: () => <svg />,
email: () => <svg />,
github: () => <svg />,
group: () => <svg />,
help: () => <svg />,
user: () => <svg />,
warning: () => <svg />,
brokenImage: MockIcon,
catalog: MockIcon,
scaffolder: MockIcon,
techdocs: MockIcon,
search: MockIcon,
chat: MockIcon,
dashboard: MockIcon,
docs: MockIcon,
email: MockIcon,
github: MockIcon,
group: MockIcon,
help: MockIcon,
user: MockIcon,
warning: MockIcon,
};
const ErrorBoundaryFallback = ({ error }: { error: Error }) => {
@@ -136,9 +139,13 @@ export function wrapInTestApp(
themes: [
{
id: 'light',
theme: lightTheme,
title: 'Test App Theme',
variant: 'light',
Provider: ({ children }) => (
<ThemeProvider theme={lightTheme}>
<CssBaseline>{children}</CssBaseline>
</ThemeProvider>
),
},
],
bindRoutes: ({ bind }) => {