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);
});

Explanation

Parameterized tests remove copy-paste and make edge cases easy to add.

Further reading

Problem with a question

Testing · Junior · question 73

Test yourself

Take the Testing · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz