-
Notifications
You must be signed in to change notification settings - Fork 783
test: Added tests for auth reducer and refactored some other tests #579
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
Conversation
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.
End tests in .js
, not .spec.js
. Besides that looks good.
Also - don't end data files in |
There's a lot of data in |
I'll rename those files, yeah it's quite a bit of data; I just took the GitHub example responses verbatim from the API docs. Since the file isn't used in a build is it a good idea to just keep data as a copy of the example responses incase it ever needs to be changed? |
@andrewda done. What's the reasoning behind not using |
@jglover Several reasons: 1) when I began adding tests, I didn't use it, and we've stayed consistent with that, 2) everything's already in a single |
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.
Besides @andrewda changes. LGTM
src/utils/localization-helper.js
Outdated
@@ -8,7 +8,8 @@ export const translate = (key, locale, interpolation = null) => | |||
I18n.t(key, { locale, ...interpolation }); | |||
|
|||
export const getLocale = () => { | |||
const locale = I18n.locale.toLowerCase(); | |||
// If for some reason a locale cannot be determined, fall back to 'en'. | |||
const locale = (I18n.locale && I18n.locale.toLowerCase()) || 'en'; |
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.
💯
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.
@jglover Please read en
from src/config/common
, as well as the comment.
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.
@chinesedfan good tip, updated.
@andrewda Anything left outstanding? Keen to get this merged before it gets conflicts. |
src/utils/localization-helper.js
Outdated
@@ -8,7 +8,8 @@ export const translate = (key, locale, interpolation = null) => | |||
I18n.t(key, { locale, ...interpolation }); | |||
|
|||
export const getLocale = () => { | |||
const locale = I18n.locale.toLowerCase(); | |||
// If for some reason a locale cannot be determined, fall back to 'en'. | |||
const locale = (I18n.locale && I18n.locale.toLowerCase()) || 'en'; |
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.
@jglover Please read en
from src/config/common
, as well as the comment.
Adds test for auth reducer and refactoring.
Also adds default fallback for 'en' inside
localization-helper
incase location cannot be determined/promise to get locale inapp.js
has not fulfilled yet and somehow user has navigated, requiring a value (this was breaking unit tests).