anitab-org / anitab-forms-web

AnitaB Forms (web), an application to process smaller 4-week or full day programs to contribute to open source projects. Similar to GSoC, Outreachy, or RGSoC. This is the web app.
GNU General Public License v3.0
42 stars 78 forks source link

Tests: Add tests for checking validations on Register form #175

Closed jennypoon closed 2 years ago

jennypoon commented 2 years ago

Description

Add tests to check input validations and button ui on Register form

Fixes #173

Type of Change:

How Has This Been Tested?

Run npm test on the CLI - all tests should pass

Checklist:

Code/Quality Assurance Only

jennypoon commented 2 years ago

@jennypoon Great work 👍 There are few tests which I think can be added:

  1. Mock the Axios and test for the condition where a username is already registered.
  2. Successful Registration message check.
  3. 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?

codesankalp commented 2 years ago

@jennypoon Great work +1 There are few tests which I think can be added:

  1. Mock the Axios and test for the condition where a username is already registered.
  2. Successful Registration message check.
  3. 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.

jennypoon commented 2 years ago

PR have been added to include the suggested tests.

isabelcosta commented 2 years ago

@Aaishpra thank you for testing this 🙏🏾 really really appreciate it

isabelcosta commented 2 years ago

Great work @jennypoon 👏🏾 🙌🏾