Vitest: test.each reference
30 July 2023 (Updated 30 July 2023)
test.each([
[1, 1, 2],
[1, 2, 3],
[2, 1, 3],
])('add(%i, %i) -> %i', (a, b, expected) => {
expect(a + b).toBe(expected)
})
// this will return
// ✓ add(1, 1) -> 2
// ✓ add(1, 2) -> 3
// ✓ add(2, 1) -> 3
Sources
Tagged:
Vitest
Thanks for your comment 🙏. Once it's approved, it will appear here.
Leave a comment