DEV Community

Jonathan Cohen
Jonathan Cohen

Posted on

2 2

Surely you Jest?

It's been a busy busy week for me. Somehow I'm managing the time to be able to try and learn new thing weekly. Honestly, I'm amazed...although I do wish there was more time in the day to try my hand at more things and carve out more time for myself. Alas, we do what we can with what we have and this week I started trying my hand and testing in JS with the jest framework.

Jest can be thought of as a testing framework that is designed to ensure correctness of any JS codebase. So far in my experience, I've been practicing with the keywords of describe, test, expect and to be. Since I'm in my early stages of working with this framework, I will only talk about the describe function today.

Describe()
-Takes in two arguments, a string of the name of the function and a function. The block of the describe function is usually home to the test function. In certain cases you can even have multiple test functions called within one describe block. Below is an example of how describe could be used.

describe("ten()", () => {

  });
Enter fullscreen mode Exit fullscreen mode

The describe function has a string as the first argument. The string is ten(). After this string is given to identify the name of the function we're testing, we now have to test it. Next week we'll combine this example with the test function and really start to see some cool things. Happy Coding.

Heroku

Build apps, not infrastructure.

Dealing with servers, hardware, and infrastructure can take up your valuable time. Discover the benefits of Heroku, the PaaS of choice for developers since 2007.

Visit Site

Top comments (0)

Heroku

This site is built on Heroku

Join the ranks of developers at Salesforce, Airbase, DEV, and more who deploy their mission critical applications on Heroku. Sign up today and launch your first app!

Get Started

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay