I'm trying to do parameterized testing with Jest 24
https://archive.jestjs.io/docs/en/24.x/api#2--testeachtablename-fn-timeout-
My test looks like:
it.each`
startDate | endDate | expected
${new Date(2022, 1, 20)} | ${new Date(2022, 1, 21)} | 1
${new Date(2022, 1, 20)} | ${new Date(2022, 1, 22)} | 1
${new Date(2022, 1, 20)} | ${new Date(2022, 1, 23)} | 1
${new Date(2022, 1, 20)} | ${new Date(2022, 1, 24)} | 2
${new Date(2022, 1, 20)} | ${new Date(2022, 1, 29)} | 7
${new Date(2022, 1, 20)} | ${new Date(2022, 1, 30)} | 7
${new Date(2022, 1, 20)} | ${new Date(2022, 1, 31)} | 8
${new Date(2022, 1, 20)} | ${new Date(2022, 2, 1)} | 9
`('weekend days are not counted', ({startDate, endDate, expected}) => {
...
});
But when I run it:
Not enough arguments supplied for given headings:
startDate | endDate | expected
Received:
Array [
2022-02-20T00:00:00.000Z,
2022-02-21T00:00:00.000Z,
2022-02-20T00:00:00.000Z,
2022-02-22T00:00:00.000Z,
2022-02-20T00:00:00.000Z,
2022-02-23T00:00:00.000Z,
2022-02-20T00:00:00.000Z,
2022-02-24T00:00:00.000Z,
2022-02-20T00:00:00.000Z,
2022-03-01T00:00:00.000Z,
2022-02-20T00:00:00.000Z,
2022-03-02T00:00:00.000Z,
2022-02-20T00:00:00.000Z,
2022-03-03T00:00:00.000Z,
2022-02-20T00:00:00.000Z,
2022-03-01T00:00:00.000Z,
]
Missing 1 argument
Can someone explain what is wrong?