BhavyaCodes / pokemon

https://pokemon-hacktoberfest.vercel.app
15 stars 40 forks source link

Setup unit tests in project #42

Closed bhavin-a closed 3 years ago

bhavin-a commented 3 years ago

This PR adds unit testing for all the present React components. This PR contains some snapshots which are auto-generated and required to committed so that jest can compare them while running an updated code. This would increase our code size but it's introduced for something good :smiley:

How to check this PR?

  1. Checkout this branch
  2. Run command - npm test -- --coverage --watchAll=false. This will generate a code coverage report on the terminal.

We should try to keep this percentage 100% all the time for all the components. Ideally, for any change we introduce to the code, we should run the above command and check if everything passes. If not, we should either look at why is it failing :confused: If there is a failure, it means it changes the UI how it currently looks! Either fix that or if that is intended, update the TC after consulting someone from the core team.

@Juggernaut9 I would also request we look into the setup of a tool husky that runs these tests automatically before raising a PR. This might add an overhead and should be looked only when this project matures but should definitely avoid some errors :smile:

Link for husky: https://www.npmjs.com/package/husky

vercel[bot] commented 3 years ago

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/juggernaut9/pokemon-hacktoberfest/dw4donu4t
✅ Preview: https://pokemon-hacktoberf-git-feaa4f3f83f92774822f20c90f7b0eadd-2f1b87.juggernaut9.vercel.app

BhavyaCodes commented 3 years ago

hey, thanks for the feature, but this is a really big pull request (based on lines of code). Im gonna check it tomorrow

bhavin-a commented 3 years ago

Hi @Juggernaut9

Have updated this PR with the latest code. Thanks! :+1:

BhavyaCodes commented 3 years ago

Sorry i've been lazy to review this :( I have labelled your PR as hacktoberfest-accepted

bhavin-a commented 3 years ago

Sorry i've been lazy to review this :( I have labelled your PR as hacktoberfest-accepted

:sweat_smile: No problem @Juggernaut9 , can understand. Thanks much for labelling this. Just let me know when you plan to merge this. Till that point, it may require an update.

Thanks again :smile: !

BhavyaCodes commented 3 years ago

Ok I didn't review it but im trusting you that It won't break anything xD

BhavyaCodes commented 3 years ago

Glanced through the changes real quick, I think I should learn some basics of testing!

bhavin-a commented 3 years ago

Ok I didn't review it but im trusting you that It won't break anything xD

Sure @Juggernaut9 :smile: . Just unit tests, so it shouldn't break anything :small_airplane:

bhavin-a commented 3 years ago

Glanced through the changes real quick, I think I should learn some basics of testing!

Let me know if you need any help with this :grinning: