Testing · Junior · Question 73 of 78
What does test.each / it.each do?
test.each([
[1, 1, 2],
[2, 3, 5],
])("add(%i, %i) = %i", (a, b, expected) => {
expect(add(a, b)).toBe(expected);
});- ✓Correct answer: Runs the same test with different data sets
- 2Runs a test for each file in the folder
- 3Repeats the test until it passes
Explanation
Parameterized tests remove copy-paste and make edge cases easy to add.