I'm trying to test for an error not being thrown, and I've done the following in my test:
await expect(() => execute(1, 1)).rejects.not.toThrow()
The test fails when execute throws an error, as I want it to. However, when execute resolves successfully, I get the following test failure:
Received promise resolved instead of rejected
Resolved to value: undefined
I've previously used Jasmine for this sort of thing, and it happily does expect(() => codeThrowingError).not.toThrow(), but the syntax for Jest seems a bit more tortured and I'm not sure how to get this right.