W3cubDocs

/Jasmine

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'});

© 2008–2017 Pivotal Labs
Licensed under the MIT License.
https://jasmine.github.io/api/3.2/async-matchers.html