When I use it.each from jest I get an error when defining the callback for it
Argument of type '(n: any) => Promise<void>' is not assignable to parameter of type '() => any'.ts(2345)
The code with the it.each is outlined below:
it.each([null, undefined, []])('should throw Http exception with expected exception message', async (n) => {
await expect(() => service.check(n)).rejects.toThrow(
new HttpException(
{
statusCode: HttpStatus.BAD_REQUEST,
message: "Nothing to check",
error: HttpStatus.BAD_REQUEST,
},
HttpStatus.BAD_REQUEST,
),
);
});
The jest types and the jest version are shown below if it helps:
"@types/jest": "^27.4.1",
"jest": "^27.2.5",
The issue is with the async (n) => ... any help is much appreciated, thanks!