Showing posts from 2021

Parameterized tests in JavaScript with Jest

Parameterized tests are used to test the same code under different conditions. One can set up a test method that retrieves data from a data source. This data source can be a collection of objects, external file or maybe even a database. The general idea is to make it easy to test different conditions with the same test method to avoid duplication and make the code easier to read and maintain. Jest has a built-in support for tests parameterized with data table that can be provided either by an array of arrays or as tagged template literal .

Testing promise rejection in JavaScript with Jest

Testing exceptions in JavaScript with Jest