Closed jennypoon closed 2 years ago
@jennypoon Great work 👍 There are few tests which I think can be added:
- Mock the Axios and test for the condition where a username is already registered.
- Successful Registration message check.
- On toggling the Password eye icon it should show or hide the password.
I'm pretty new to testing. Could you provide some guidance on how I can mock the postRegister
axios request and then check to see if there's a success message on the Register component?
@jennypoon Great work +1 There are few tests which I think can be added:
- Mock the Axios and test for the condition where a username is already registered.
- Successful Registration message check.
- On toggling the Password eye icon it should show or hide the password.
I'm pretty new to testing. Could you provide some guidance on how I can mock the
postRegister
axios request and then check to see if there's a success message on the Register component?
@jennypoon You can mock the Axios request, see this for reference: https://jestjs.io/docs/mock-functions#mocking-modules after this, all the other things are the same i.e. mock the implementation of Axios, submit the form, and expect that a successful response is being returned.
PR have been added to include the suggested tests.
@Aaishpra thank you for testing this 🙏🏾 really really appreciate it
Great work @jennypoon 👏🏾 🙌🏾
Description
Add tests to check input validations and button ui on Register form
Fixes #173
Type of Change:
data-testid
to input and button componentsHow Has This Been Tested?
Run
npm test
on the CLI - all tests should passChecklist:
Code/Quality Assurance Only