-
Notifications
You must be signed in to change notification settings - Fork 7
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
#166840878 User signup error swag #21
Conversation
00065de
to
280da95
Compare
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.
Good job @tolumide-ng and @olorunwalawrence.
Please endeavour to remove all the unneeded comments on your code.
src/pages/Signup/index.js
Outdated
<div className="w-7/12 p-10"> | ||
{/* logo and inputs */} | ||
<div className="w-full flex flex-col items-center p-2 mx-auto"> | ||
{/* <div className="w-5/6 mx-auto bg-white mt-10 mb-4 text-center flex flex-col items-center"> */} |
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.
you may need to remove these comments please.
src/fakeData.js
Outdated
} | ||
} | ||
] | ||
}; |
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 what is the value of this file to this PR?
a7b6752
to
0cf2fdf
Compare
0cf2fdf
to
e1e82b7
Compare
e1e82b7
to
ddb969e
Compare
ddb969e
to
6f1930c
Compare
6f1930c
to
bf67ce4
Compare
bf67ce4
to
927f99b
Compare
927f99b
to
2a8d4d9
Compare
2a8d4d9
to
710b910
Compare
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.
@olorunwalawrence @tolumide-ng
This is good. Tests need a bit more work but good job guys.
tests/signup.spec.js
Outdated
}); | ||
const fake = jest.fn(); | ||
|
||
describe('it should work', () => { |
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.
This should be the component being described
tests/signup.spec.js
Outdated
it('renders the component', () => { | ||
expect(wrapper.exists()).toBe(true); | ||
expect(wrapper.find('Form').exists()).toBe(true); | ||
expect(wrapper.find('button').exists()).toBe(true); |
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.
I think asserting that there's a submit button (type=submit)/ the text in the button is more useful than just that there's a button.
Assert the number of buttons. Other important form elements as well.
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.
This test doesn't actually test that the component signs a user up. And that is reasonable because the component doesn't sign a user up. The action/network request does that. The component only displays what is appropriate based on the application state.
Also, add test for negative paths e.g when a user enters invalid data.
Hypothetical Solution
const jest.fn(() => 'lol')
state = { signUp }
// then in your test.
sbmitBtn.simulate('click');
// then you should be able to do:
expect(signUp).toHaveBeenCalled();
expect(signUp).toHaveBeenCalledTimes(1);
8132b66
to
d3839fb
Compare
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.
Nice work Noticed the integration of various packages including toastr
left some comment behind
Apart from the comment I also think you should try removing .DS_STORE
from the PR
src/pages/Signup/index.js
Outdated
import { Formik, Form, Field } from 'formik'; | ||
import { signupAction } from '../../store/modules/auth/actions/signup'; | ||
import logo from '../../assets/images/logo.png'; | ||
// import signupCard from '../../assets/images/signup.png'; |
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.
Remove comments from the code
d3839fb
to
5c9c31b
Compare
5c9c31b
to
e3560d1
Compare
Thank you for your observation. The tests are already been catered for by @kechyy since we are using the same actions and reducers |
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.
Well done guys. You may need to check out the comments I left.
@@ -77,7 +79,7 @@ describe('SocialMediaLogin', () => { | |||
</Provider> | |||
); | |||
|
|||
expect(localStorage.getItem('token')).toEqual(userToken); | |||
// expect(localStorage.getItem('token')).toEqual(userToken); |
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.
I suggest you reach out next time, instead of commenting this assertion
out.
You may need to replace that assertion with
expect(JSON.parse(localStorage.getItem('token'))).toEqual(userToken);
Thank you.
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.
I suggest you reach out next time, instead of commenting this
assertion
out.
You may need to replace that assertion withexpect(JSON.parse(localStorage.getItem('token'))).toEqual(userToken); Thank you.
Hello @Onyimatics , thank you for the review. However, there is no problem with the previous assertion. I only forgot to remove the comments after testing what I needed on this part of the code. Thank you.
src/pages/Signup/index.spec.js
Outdated
location, | ||
status: 'authenticationLoading', | ||
SignUp: jest.fn(({ userData = {}, history, location }, cb) => { | ||
cb({ data: true }); |
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.
I suggest you consider making the name of this cb
more descriptive.
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.
Okay
src/pages/Signup/index.spec.js
Outdated
); | ||
}; | ||
|
||
describe.only('SignupForm User Input Validation', () => { |
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.
I guess you must have forgotten to remove this .only
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.
Yh, I did. Thank you
const { message } = error.response.data; | ||
return url ? history.push(url) : history.push('/articles'); | ||
} catch ({ response }) { | ||
const { message } = response.data; |
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.
instead of removing these lines
} catch (error) {
const { message } = error.response.data;
```, I suggest you use an `if` statement there to also cater for the error coming from `error.response.data` , incase a user encounters a `network error`.
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.
Oh True. However, In the case of a network failure, axios
still returns a response since that it is what was stated on the try block.
Hence, I think
const message = response && response.data && response.data.message
might be okay. What do you think?
__test__/App.spec.js
Outdated
@@ -1,6 +1,7 @@ | |||
import React from 'react'; | |||
import { BrowserRouter, Switch } from 'react-router-dom'; | |||
import thunk from 'redux-thunk'; | |||
import { mount } from 'enzyme'; |
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.
Hi @tolumide-ng and @olorunwalawrence,
Please remove the mount
function since it has been configured globally on the project.
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.
Okay
__test__/components/navbar.spec.js
Outdated
@@ -1,6 +1,7 @@ | |||
import React from 'react'; | |||
import { Provider } from 'react-redux'; | |||
import configureStore from 'redux-mock-store'; | |||
import { mount } from 'enzyme'; |
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.
Hi @tolumide-ng and @olorunwalawrence,
Please remove the mount
function since it has been configured globally on the project.
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.
sorry this mount is on navbar component not on the signup
enzyme.config.js
Outdated
@@ -0,0 +1,4 @@ | |||
import { configure } from 'enzyme'; |
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.
I think there is no need for this file enzyme.config.js
, the configurations therein are already implemented on __test__/setup.js
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.
Okay
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.
Good job @tolumide-ng and @olorunwalawrence 👍
There are 4 commits, please squash them. Also, attend to the comments.
Thank you for your review. However, commits cannot be squashed yet as instructed by the TTL since this is a collaborated PR |
871a7a1
to
c82892c
Compare
c82892c
to
35b3024
Compare
Thank you @timi-codes . The actions, thunk and reducers are not tested at all in this PR since this feature was implemented in conjunction with the login feature (assigned to @tobechukwuobitube and @kechyy ), they are already testing the actions and reducers appropriately. Thank you once again |
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.
@olorunwalawrence @tolumide-ng Good job on this pull request. However, Kindly attend to all the changes as soon as possible so that we can have this merged today.
package.json
Outdated
"glob": "^7.1.4", | ||
"html-webpack-plugin": "^3.2.0", | ||
"i": "^0.3.6", |
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.
kindly remove this as it must have been installed in err.
package.json
Outdated
"jest-svg-transformer": "^1.0.0", | ||
"jwt-decode": "^2.2.0", | ||
"mini-css-extract-plugin": "^0.8.0", | ||
"npm": "^6.11.0", |
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.
kindly remove this as it must have been installed in err.
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.
👍
src/index.css
Outdated
@@ -0,0 +1,9 @@ | |||
@tailwind base; |
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 use the main.scss
for global stylings
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.
I guess, this was when you changed the file configuration to sass as it was initially index.css when I setup the tailwindcss
I would remove that now
Changes attended. Please rereview |
5d3e1d7
to
74efdeb
Compare
33e1b37
to
63f7d0c
Compare
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.
🎊 This is good.
Make the correction on the SignUp form header and merge.
src/pages/Signup/index.js
Outdated
<div className="w-11/12 md:w-9/12 lg:w-7/12 mx-auto m-16 rounded-lg flex items-stretch bg-red-400 h-100"> | ||
<div className="md:flex max-w-lg w-7/12 bg-color height items-center signup-card hidden rounded-l-lg "> | ||
<div className=" pl-8 font-bold text-left text-white text-2xl"> | ||
<div>Welcome back,</div> |
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.
Change Welcome back,
to Welcome to ErrorSwag
.
Wrap this text in an h1
tag or the most appropriate heading tag. This is important for accessibility and SEO.
Use <br>
tags to break the text into multiple lines if needed.
63f7d0c
to
304e38f
Compare
- Corrects bug on password non-conformity - Adds Animation to show loading during user signup - Adds Social Media Buttons for user signup authentication - Fixes CSS on user signup - Implements state and reducers for signup - Creates UI for errorswag signup page - Returns relevant error message on user signup action - Implements recommended feedback on UI label and redux state params - Implements state and reducers for signup - Creates UI for errorswag signup page - Returns relevant error message on user signup action - Implements recommended feedback on UI label and redux state params [Delivers #166840878]
304e38f
to
0b55939
Compare
What does this PR do?
Description of Task to be completed?
How should this be manually tested?
Any background context you want to provide?
What are the relevant pivotal tracker stories?(if applicable)
#166840878
Screenshots
166840878