When you write a test in Jest and you want to run it with different data, you can use the test.each function. The function accepts a data table, which is an array of arrays with the arguments that are passed to the actual test function.

const table = [
["one", 1],
["two", 2],
["three", 3],

test.each(table)("converts %s to %d", (str, expected) => {
// Will be called 3 times with "one", "two", "three"
const result = convertToNumber(str);

The title of the test can inject parameters with printf formatting (like %s for a string and %d for a number).

Read more about this in the Jest documentation.