test-utils: Allow ExternalRouteRef on mountedRoutes
Co-authored-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
@@ -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,
|
||||
},
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user