There’s an in-built way to do this: test.each(table)(name, fn, timeout)
e.g.
test.each([[1, 1, 2], [1, 2, 3], [2, 1, 3]])(
'.add(%i, %i)',
(a, b, expected) => {
expect(a + b).toBe(expected);
},
);
where each inner array in the 2D array is passed as args to the test function.