Jest running same test with multiple test data

Type
Gist
Published
July 5, 2024
Author
Chetan Agrawal
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); expect(result).toBe(expected); });