Skip to content

Commit

Permalink
fix(valid-expect-in-promise): fix type exception
Browse files Browse the repository at this point in the history
Fixes #195
  • Loading branch information
lukeapage authored and SimenB committed Nov 6, 2018
1 parent 02cd21a commit 60919f6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions rules/__tests__/valid-expect-in-promise.test.js
Expand Up @@ -182,6 +182,15 @@ ruleTester.run('valid-expect-in-promise', rule, {
],

valid: [
`
it('it1', () => new Promise((done) => {
test()
.then(() => {
expect(someThing).toEqual(true);
done();
});
}));
`,
`
it('it1', () => {
return somePromise.then(() => {
Expand Down
1 change: 1 addition & 0 deletions rules/valid-expect-in-promise.js
Expand Up @@ -88,6 +88,7 @@ const getTestFunction = node => {
const isParentThenOrPromiseReturned = (node, testFunctionBody) => {
return (
testFunctionBody.type === 'CallExpression' ||
testFunctionBody.type === 'NewExpression' ||
node.parent.parent.type === 'ReturnStatement' ||
isPromiseReturnedLater(node, testFunctionBody) ||
isThenOrCatch(node.parent.parent)
Expand Down

0 comments on commit 60919f6

Please sign in to comment.