Add icons as an optional property of renderInTestApp

Signed-off-by: Rik Claessens <rhmclaessens@gmail.com>
This commit is contained in:
Rik Claessens
2024-07-13 11:32:19 +02:00
parent 960b292c68
commit 469877ba24
@@ -23,13 +23,14 @@ import React, {
import { MemoryRouter, Route } from 'react-router-dom';
import { themes, UnifiedThemeProvider } from '@backstage/theme';
import MockIcon from '@material-ui/icons/AcUnit';
import { createSpecializedApp } from '@backstage/core-app-api';
import { AppIcons, createSpecializedApp } from '@backstage/core-app-api';
import {
AppComponents,
attachComponentData,
BootErrorPageProps,
createRouteRef,
ExternalRouteRef,
IconComponent,
RouteRef,
} from '@backstage/core-plugin-api';
import { MatcherFunction, RenderResult } from '@testing-library/react';
@@ -107,6 +108,13 @@ export type TestAppOptions = {
* Components to be forwarded to the `components` option of `createApp`.
*/
components?: Partial<AppComponents>;
/**
* Icons to be forwarded to the `icons` option of `createApp`.
*/
icons?: Partial<AppIcons> & {
[key in string]: IconComponent;
};
};
function isExternalRouteRef(
@@ -145,7 +153,10 @@ export function createTestAppWrapper(
),
...options.components,
},
icons: mockIcons,
icons: {
...mockIcons,
...options.icons,
},
plugins: [],
themes: [
{