-
Notifications
You must be signed in to change notification settings - Fork 96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor route definition - Closes #499 #542
Conversation
src/constants/routes.js
Outdated
dashboard: { url: '/dashboard' }, | ||
search: { url: '/search' }, | ||
searchResult: { url: '/result' }, | ||
transaction: { url: '/transactions' }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why did you remove short routes ?
src/components/login/login.test.js
Outdated
@@ -85,18 +86,18 @@ describe('Login', () => { | |||
}); | |||
|
|||
describe('History management', () => { | |||
it('calls this.props.history.replace(\'/main/dashboard\')', () => { | |||
it(`calls this.props.history.replace('${routes.main}${routes.dashboard.url}')`, () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update the it
blocks with descriptions that are more readable (as you were already changing them anyway). We want to avoid exactly the situation that you were in here, where when we change some implementation, the describe blocks have to be updated too. Instead, by having a general readable description of what we are expecting, there will be no need to always update the blocks. So one possible example could be, instead of
calls this.props.history.replace('${routes.main}${routes.dashboard.url}')
-> redirects to dashboard
src/utils/routes.js
Outdated
params: 'query', | ||
name: 'result', | ||
}, { | ||
regex: /\/explorer\/search(?:\/[^/]*)?$/, | ||
path: `${routes.search.long}/`, | ||
path: `/explorer${routes.search.url}/`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not ${routes.explorer}
instead of /explorer
?
25ef2ae
to
abb5f11
Compare
…iskHQ/lisk-hub into 499-refactor-route-definitions
What was the problem?
Some routes definitions were in the string
How did I fix it?
Created constants for route
How to test it?
Search for
main
andexplorer
to check if route definition comes from one fileReview checklist