Documentation Home
This page is for an older version of Jasmine (3.2).
The current stable version of Jasmine is: 5.4. You can also look at the docs for the next release: Edge

Namespace: async-matchers

async-matchers

Asynchronous matchers.

Methods

(async) toBeRejected()

Expect a promise to be rejected.

Examples
await expectAsync(aPromise).toBeRejected();
return expectAsync(aPromise).toBeRejected();

(async) toBeResolved()

Expect a promise to be resolved.

Examples
await expectAsync(aPromise).toBeResolved();
return expectAsync(aPromise).toBeResolved();

(async) toBeResolvedTo(expected)

Expect a promise to be resolved to a value equal to the expected, using deep equality comparison.

Parameters:
Name Type Description
expected Object

Value that the promise is expected to resolve to

Examples
await expectAsync(aPromise).toBeResolvedTo({prop: 'value'});
return expectAsync(aPromise).toBeResolvedTo({prop: 'value'});