-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(routing): 11991 - redirect to base url if faced 403 on bivariate…
… color manager page - history added to have possiblity to interact with history in atoms - tests for history - 403 response is parsed in getProblemFromError (was unknown previously)
- Loading branch information
Showing
9 changed files
with
75 additions
and
22 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import config from '~core/app_config'; | ||
|
||
export const ROUTE_PATHS = { | ||
base: config.baseUrl, | ||
reports: config.baseUrl + 'reports', | ||
reportPage: config.baseUrl + 'reports/:reportId', | ||
bivariateManager: config.baseUrl + 'bivariate-manager', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/** | ||
* @vitest-environment happy-dom | ||
*/ | ||
import * as React from 'react'; | ||
import { test, expect } from 'vitest'; | ||
import sinon from 'sinon'; | ||
import history from './history'; | ||
import { Router } from 'react-router-dom'; | ||
import { useHistory } from 'react-router'; | ||
import { fireEvent, render } from '@testing-library/react'; | ||
|
||
const TestRoute = () => { | ||
const history = useHistory(); | ||
return ( | ||
<div> | ||
<button onClick={() => history.push('/test')} /> | ||
</div> | ||
); | ||
}; | ||
|
||
test('~core/history obj is used inside <Router> correctly', async () => { | ||
const spy = sinon.spy(history, 'push'); | ||
|
||
const { getByRole } = render( | ||
<Router history={history}> | ||
<TestRoute /> | ||
</Router>, | ||
); | ||
|
||
fireEvent.click(getByRole('button')); | ||
expect(spy.callCount).toBe(1); | ||
expect(history.location.pathname).toBe('/test'); | ||
spy.restore(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
import { createBrowserHistory } from 'history'; | ||
export default createBrowserHistory(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters