-
Notifications
You must be signed in to change notification settings - Fork 248
Closed
Description
using eslint-plugin-jest v22.15.2
This reports an error:
const fetch = url =>
Promise.resolve({
url,
text: () => Promise.resolve('text'),
});
// Error: Promise should be returned to test its fulfillment or rejection
test('valid-expect-in-promise', async () => {
const text = await fetch('url')
.then(res => res.text())
.then(text => text);
expect(text).toBe('text');
});If I remove the last .then, no error is reported:
// No eslint errors
test('valid-expect-in-promise', async () => {
const text = await fetch('url')
.then(res => res.text())
expect(text).toBe('text');
});The following doesn't report error, so perhaps the problem is not in chaining:
// No eslint errors
test('valid-expect-in-promise', async () => {
const text = await fetch('url')
.then(text => text)
.then(text => text);
expect(text).toBe('text');
});DanielSWolfG-Rath and janKollars