How to run multiple variations of the same test
May 05, 2020
In some specs that we write daily, we want to have the ability to write multiple variations of the same test. For example if we have a function that adds two numbers together, you would want to try multiple variations for that function’s spec to truly test each case you could think of. For example you would like to add two positive numbers, two negative number, or one positive and one negative number.
You can do that by duplicating the spec multiple times and each time you assert different values. The other neat solution is to use jest.each or jest-in-case