-
Notifications
You must be signed in to change notification settings - Fork 75
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
bug #930: added email property check, ensuring the correct response. #1066
base: master
Are you sure you want to change the base?
bug #930: added email property check, ensuring the correct response. #1066
Conversation
Thanks, @dev-rahulbhadoriya! I have a couple of small suggestions. First, I think we should use It'd be great if you could also add a test to test/integration/api/users.js for the new behavior. The test could send a request without Also, just FYI, the project is going to be quieter for the next couple of weeks. You may find that additional review is delayed until 2024. Thanks again for submitting this PR! |
@matthew-white , thanks for the suggestions and for reviewing my PR. I have corrected the code and added a test case for it. Kindly check and review it |
test/integration/api/users.js
Outdated
it('should fail the request if email field is sent blank in request body', testService((service) => | ||
service.login('alice', (asAlice) => | ||
asAlice.post('/v1/users/reset/initiate') | ||
.send({ email: '' }) | ||
.expect(400)))); |
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.
Would you mind also adding assertions about the response body? code
should equal 400.2, and details
should equal { field: 'email' }
.
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.
can do something like this ?
it('should fail the request if email field is sent blank in request body', testService((service) => service.login('alice', (asAlice) => asAlice.post('/v1/users/reset/initiate') .send({ email: '' }) .expect(400) .then(({ body: { code, details } }) => { details.should.eql({ field: 'email' }); code.should.eql(400.2); }))));
Closes #930
Added a check for the email field. If the property is missing or not included in the request body, an error 400.23 ( propertyNotFound) will be returned.
What has been done to verify that this works as intended?
Tested with postman.
Why is this the best possible solution? Were any other approaches considered?
How does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?
Does this change require updates to the API documentation? If so, please update docs/api.md as part of this PR.
Before submitting this PR, please make sure you have:
make test-full
and confirmed all checks still pass OR confirm CircleCI build passes