Namespace: async-matchers

async-matchers

Methods

(async) toBeRejected()

Expect a promise to be rejected.
Source:
Examples
await expectAsync(aPromise).toBeRejected();
return expectAsync(aPromise).toBeRejected();

(async) toBeResolved()

Expect a promise to be resolved.
Source:
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
Source:
Examples
await expectAsync(aPromise).toBeResolvedTo({prop: 'value'});
return expectAsync(aPromise).toBeResolvedTo({prop: 'value'});