I know the benefits of using test.each over forEach and would like to convert some of my tests. The problem: I look around and all I see is very unclean ways of writing the same.
Is there a way to use test.each in a way
const testCases = [
{ value: true, anothervalue: 12 },
{ value: false, anotherValue: 13 },
]
testCases.forEach(({ value, anotherValue }) => {
it(`should set ${value} to ${!!anotherValue}`, async () => {
await doSomething(value)
expect(doSomething).toEqual(`something${anotherValue}`)
)
})
Is there a way to implement something similar using test.each
that is also very readable and clean?