Ensure to return promise when having assertions in then
or catch
block of
promise
This rule triggers a warning if,
- test is having assertions in
then
orcatch
block of a promise - and that promise is not returned from the test
The following pattern is considered warning:
it('promise test', () => {
somePromise.then(data => {
expect(data).toEqual('foo');
});
});
The following pattern is not warning:
it('promise test', () => {
return somePromise.then(data => {
expect(data).toEqual('foo');
});
});