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