diff --git a/packages/test-utils/src/testUtils/appWrappers.test.tsx b/packages/test-utils/src/testUtils/appWrappers.test.tsx index 4899f07061..1283128df2 100644 --- a/packages/test-utils/src/testUtils/appWrappers.test.tsx +++ b/packages/test-utils/src/testUtils/appWrappers.test.tsx @@ -14,20 +14,22 @@ * limitations under the License. */ -import React, { useEffect } from 'react'; -import { render } from '@testing-library/react'; -import { wrapInTestApp, renderInTestApp } from './appWrappers'; -import { Route, Routes } from 'react-router'; -import { withLogCollector } from '@backstage/test-utils-core'; import { - useApi, - useRouteRef, - errorApiRef, ApiProvider, ApiRegistry, + createExternalRouteRef, createRouteRef, + createSubRouteRef, + errorApiRef, + useApi, + useRouteRef, } from '@backstage/core-api'; +import { withLogCollector } from '@backstage/test-utils-core'; +import { render } from '@testing-library/react'; +import React, { useEffect } from 'react'; +import { Route, Routes } from 'react-router'; import { MockErrorApi } from './apis'; +import { renderInTestApp, wrapInTestApp } from './appWrappers'; describe('wrapInTestApp', () => { it('should provide routing and warn about missing act()', async () => { @@ -117,16 +119,29 @@ describe('wrapInTestApp', () => { }); it('should allow route refs to be mounted on specific paths', async () => { - const aRouteRef = createRouteRef({ title: 'A' }); - const bRouteRef = createRouteRef({ title: 'B', params: ['name'] }); + const aRouteRef = createRouteRef({ id: 'A' }); + const bRouteRef = createRouteRef({ id: 'B', params: ['name'] }); + const subRouteRef = createSubRouteRef({ + id: 'S', + parent: bRouteRef, + path: '/:page', + }); + const externalRouteRef = createExternalRouteRef({ + id: 'E', + params: ['name'], + }); const MyComponent = () => { const a = useRouteRef(aRouteRef); const b = useRouteRef(bRouteRef); + const s = useRouteRef(subRouteRef); + const e = useRouteRef(externalRouteRef); return (