From 2fe195e8f2ffcaae70e07991e6cbebb8a82c9117 Mon Sep 17 00:00:00 2001 From: Oliver Sand Date: Fri, 19 Mar 2021 11:40:26 +0100 Subject: [PATCH] Revert everything except the test Signed-off-by: Oliver Sand --- .changeset/three-houses-learn.md | 5 ---- .../src/testUtils/appWrappers.test.tsx | 1 - .../test-utils/src/testUtils/appWrappers.tsx | 29 +++++++++---------- 3 files changed, 14 insertions(+), 21 deletions(-) delete mode 100644 .changeset/three-houses-learn.md diff --git a/.changeset/three-houses-learn.md b/.changeset/three-houses-learn.md deleted file mode 100644 index 65800eb1e8..0000000000 --- a/.changeset/three-houses-learn.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@backstage/test-utils': patch ---- - -Support routes of type `SubRouteRef` in `mountedRoutes` parameter of `renderInTestApp`. diff --git a/packages/test-utils/src/testUtils/appWrappers.test.tsx b/packages/test-utils/src/testUtils/appWrappers.test.tsx index abdc4540bc..1283128df2 100644 --- a/packages/test-utils/src/testUtils/appWrappers.test.tsx +++ b/packages/test-utils/src/testUtils/appWrappers.test.tsx @@ -150,7 +150,6 @@ describe('wrapInTestApp', () => { mountedRoutes: { '/my-a-path': aRouteRef, '/my-b-path/:name': bRouteRef, - '/my-b-path/:name/:page': subRouteRef, '/my-e-path/:name': externalRouteRef, }, }); diff --git a/packages/test-utils/src/testUtils/appWrappers.tsx b/packages/test-utils/src/testUtils/appWrappers.tsx index 8f538dd3fb..301366cbbd 100644 --- a/packages/test-utils/src/testUtils/appWrappers.tsx +++ b/packages/test-utils/src/testUtils/appWrappers.tsx @@ -14,21 +14,20 @@ * limitations under the License. */ -import privateExports, { - attachComponentData, - BootErrorPageProps, - createRouteRef, - defaultSystemIcons, - ExternalRouteRef, - RouteRef, - SubRouteRef, -} from '@backstage/core-api'; -import { renderWithEffects } from '@backstage/test-utils-core'; -import { lightTheme } from '@backstage/theme'; -import { RenderResult } from '@testing-library/react'; -import React, { ComponentType, ReactElement, ReactNode } from 'react'; +import React, { ComponentType, ReactNode, ReactElement } from 'react'; import { MemoryRouter } from 'react-router'; import { Route } from 'react-router-dom'; +import { lightTheme } from '@backstage/theme'; +import privateExports, { + defaultSystemIcons, + BootErrorPageProps, + RouteRef, + ExternalRouteRef, + attachComponentData, + createRouteRef, +} from '@backstage/core-api'; +import { RenderResult } from '@testing-library/react'; +import { renderWithEffects } from '@backstage/test-utils-core'; import { mockApis } from './mockApis'; const { PrivateAppImpl } = privateExports; @@ -64,11 +63,11 @@ type TestAppOptions = { * // ... * const link = useRouteRef(myRouteRef) */ - mountedRoutes?: { [path: string]: RouteRef | SubRouteRef | ExternalRouteRef }; + mountedRoutes?: { [path: string]: RouteRef | ExternalRouteRef }; }; function isExternalRouteRef( - routeRef: RouteRef | SubRouteRef | ExternalRouteRef, + routeRef: RouteRef | ExternalRouteRef, ): routeRef is ExternalRouteRef { // TODO(Rugvip): Least ugly workaround for now, but replace :D return String(routeRef).includes('{type=external,');