DEV Community

Gustavo Tavares
Gustavo Tavares

Posted on

OSD600 Lab08

Hi There

This week lab’s goal is to test out our SSG.
We were instructed to use a tester like Jest to test our code and check if everything is working as intended.


I choose Jest for my project as I am using JS.
It was fairly simple to use, and because I have used it before with David in previous Web courses, I knew already what I was supposed to do.


Jest was fairly simple and intuitive, I followed the Documentation to install it.
First I did:

npm install --save-dev jest
Enter fullscreen mode Exit fullscreen mode

Then I created a tester file for one of my functions.
In this tester file I did a series of small tests as instructed and tried to reach all conditions available in that function.

After that, I did some tests to test the core of my SSG.
Because I had a main function where the main action happened, it was fairly simple to do and I didn’t have to refactor my code.


To run all tests at once, I did a script as mentioned on the Documentation

"scripts": {
    "test": "jest",
Enter fullscreen mode Exit fullscreen mode

This way it run all the tests I made automatically.

Jest Tests

Thank you for reading!

Top comments (0)