Test if a promise is resolved or rejected with Jasmine in Nodejs

you can now use expectAsync()

Expecting success:

it('expect result', async () => {
   ...
   await expectAsync(someAsyncFunction(goodInput)).toBeResolved(expectedResponse)
})

Expecting failure:

it('expect result', async () => {
   ...
   await expectAsync(someAsyncFunction(badInput)).toBeRejectedWith(expectedResponse)
})

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)