BitByte-TPC / gymkhana

Official gymkhana web application
9 stars 21 forks source link

[UI] Add tests for LoginRedirect component #93

Open Samy-33 opened 2 years ago

Samy-33 commented 2 years ago

To get an idea how to write tests look at the following PR: #88

PranshuNayak commented 2 years ago

@Samy-33 there are many things in PR #88 totally new to me . Any learning resource you may suggest . I have found some videos on YouTube but don't know how useful they will be ....

Samy-33 commented 2 years ago

https://reactjs.org/docs/testing.html should help. Read about general topics for testing like mocks, spies, difference between unit tests and integration tests.

Let me know if you want a walkthrough of these tests.

PranshuNayak commented 2 years ago

https://reactjs.org/docs/testing.html should help. Read about general topics for testing like mocks, spies, difference between unit tests and integration tests.

Let me know if you want a walkthrough of these tests.

I have some doubts in Login.test.tsx if you are available

PranshuNayak commented 2 years ago

From LoginRedirect/index.tsx `const errQuery = new URLSearchParams({error: 'Please try again later!'}); const code = new URLSearchParams(window.location.search).get('code');

if (!code) {
  return navigate('/');
} `
If there is not code still redirecting to home('/') ?
Samy-33 commented 2 years ago

Should redirect to /login with appropriate error message :)

Good catch.