JavaScript / Jest Tutorial: Let's practice TDD


Now that we have seen the different tools to test your code, I suggest you to practice by discovering the principle of TDD (Test Driven Development).

The goal for this little exercise is to create a system that can convert an interval (given in ms) into an object containing days, hours, minutes, and seconds (here are the configuration files if you want to reproduce the same environment as mine https://gist.github.com/Grafikart/ffbb700bfc0c10a816652a1773c65a0b).

We start by seeing red

The first step is to create a test that will inevitably fail (since the implementation is not yet written) ....

Read more