test-utils: Allow ExternalRouteRef on mountedRoutes

Co-authored-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Johan Haals
2021-02-16 14:54:35 +01:00
parent 0b94e83ba4
commit dc12852c9e
3 changed files with 13 additions and 1 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/test-utils': patch
---
Allow `ExternalRouteRef` instances to be passed as a route ref to `mountedRoutes`.
@@ -22,6 +22,7 @@ import privateExports, {
defaultSystemIcons,
BootErrorPageProps,
RouteRef,
ExternalRouteRef,
createPlugin,
createRoutableExtension,
} from '@backstage/core-api';
@@ -62,7 +63,7 @@ type TestAppOptions = {
* // ...
* const link = useRouteRef(myRouteRef)
*/
mountedRoutes?: { [path: string]: RouteRef };
mountedRoutes?: { [path: string]: RouteRef | ExternalRouteRef };
};
/**
@@ -33,6 +33,7 @@ import { MockStorageApi, wrapInTestApp } from '@backstage/test-utils';
import { fireEvent, render, waitFor } from '@testing-library/react';
import React from 'react';
import { EntityFilterGroupsProvider } from '../../filter';
import { createComponentRouteRef } from '../../routes';
import { CatalogPage } from './CatalogPage';
describe('CatalogPage', () => {
@@ -116,6 +117,11 @@ describe('CatalogPage', () => {
>
<EntityFilterGroupsProvider>{children}</EntityFilterGroupsProvider>,
</ApiProvider>,
{
mountedRoutes: {
'/create': createComponentRouteRef,
},
},
),
);