Member-only story
A Beginner’s Guide to Jest Testing
An Explanation of how jest testing is implemented, and how this helps in the big picture.
We are gonna take a dive into test driven development first, then we are gonna dive into the tool we are gonna use which is jest. First off before anything what is test driven development?
Test Driven Development is typing as many unit test as production code to prevent less bugs. It follows the RGR principle or the Red, Green and Refractor principle.
So the red principle is writing test code, and not thinking of the implementation of production code. Design the test code for general purpose in sense that if production code needs to be changed it, the tests can be changed easily and effectively. We want to ideally write one unit test at a time, and production code for just that unit test not all the possible code.
Then we will go to the green principle or step 2. Where we will start writing all of our production code for that singular unit test.
We will write production code, where it will just be concerned about passing that specific test.