Fix duplicate slash in renderInTestApp routing
Signed-off-by: James Brooks <jamesbrooks@spotify.com>
This commit is contained in:
@@ -21,6 +21,7 @@ import {
|
||||
TestApiProvider,
|
||||
} from '@backstage/frontend-test-utils';
|
||||
import { analyticsApiRef, useAnalytics } from '@backstage/frontend-plugin-api';
|
||||
import { Routes, Route } from 'react-router-dom';
|
||||
import { renderInTestApp } from './renderInTestApp';
|
||||
|
||||
describe('renderInTestApp', () => {
|
||||
@@ -65,4 +66,18 @@ describe('renderInTestApp', () => {
|
||||
]),
|
||||
);
|
||||
});
|
||||
|
||||
it('should support setting different locations in the history stack', async () => {
|
||||
renderInTestApp(
|
||||
<Routes>
|
||||
<Route path="/" element={<h1>Index Page</h1>} />
|
||||
<Route path="/second-page" element={<h1>Second Page</h1>} />
|
||||
</Routes>,
|
||||
{
|
||||
initialRouteEntries: ['/second-page'],
|
||||
},
|
||||
);
|
||||
|
||||
expect(screen.getByText('Second Page')).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -154,7 +154,7 @@ export function renderInTestApp(
|
||||
factory: () => {
|
||||
return [
|
||||
coreExtensionData.reactElement(element),
|
||||
coreExtensionData.routePath('/'),
|
||||
coreExtensionData.routePath(''),
|
||||
];
|
||||
},
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user