src/Router: use release as a basename in BrowserRouter

The insights platform is moving to react router v6, meaning router
contexts can no longer be nested. As a result all applications will end
up sharing the same `BrowserRouter`.

Switch to using the release (`/` or `/beta/`) as a basename for the
BrowserRouter, and offload the full path (`/insights/$appname`) to the
individual routes. This makes it easier to drop the BrowserRouter in
image builder for the platform one in future.
This commit is contained in:
Sanne Raymaekers 2022-10-17 12:50:13 +02:00
parent 4c1a6c223d
commit 03421acc74
8 changed files with 35 additions and 21 deletions

View file

@ -35,7 +35,7 @@ function getCancelButton() {
function verifyCancelButton(cancel, history) {
cancel.click();
expect(history.location.pathname).toBe('/');
expect(history.location.pathname).toBe('/insights/image-builder/');
}
// packages
@ -1814,7 +1814,9 @@ describe('Click through all steps', () => {
await expect(composeImage).toHaveBeenCalledTimes(6);
// returns back to the landing page
await waitFor(() => expect(history.location.pathname).toBe('/'));
await waitFor(() =>
expect(history.location.pathname).toBe('/insights/image-builder/')
);
expect(store.getState().composes.allIds).toEqual(ids);
// set test timeout of 10 seconds
}, 10000);
@ -1936,7 +1938,7 @@ describe('Keyboard accessibility', () => {
const awsTile = screen.getByTestId('upload-aws');
userEvent.click(awsTile);
userEvent.keyboard('{esc}');
expect(history.location.pathname).toBe('/');
expect(history.location.pathname).toBe('/insights/image-builder/');
});
test('pressing Enter does not advance the wizard', async () => {