Read this short article that outlines the basic process and the benefits of TDD.
Create a new folder, be careful the name you give it should not contain any spaces (e.g no: "Jest App", yes: "JestApp"). Open Visual Studio Code and navigate to that folder. Open the terminal and type
npm init --yesto initialize a default
package.jsonfile. Then read and follow the Getting Started tutorial on the main Jest website.
Read and follow the Using Matchers document on the main Jest website. This one demonstrates some of the other useful functions you can use in your tests.
Watch this amazing next video that covers what to test in your codebase. The video is specifically about testing the Ruby language, but that doesn’t matter at all. The concepts here ring true in any language, and luckily Ruby is a clear enough language that you will be able to follow along just fine. This video might be worth re-visiting after you’ve done some testing of your own.
- Is there anything we can help with up to this point? Do you have something to suggest about this chapter? Let us know in the comments below.