Skip to content

Commit

Permalink
fix(valid-expect): members after expect are not recognized
Browse files Browse the repository at this point in the history
  • Loading branch information
Bogdan Lupu authored and Nicolas Fernandez committed Dec 2, 2016
1 parent 8f84153 commit be6454b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/rules/valid-expect.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ module.exports = function (context) {
}

// matcher was not called
if (node.parent && node.parent.parent && node.parent.parent.type !== 'CallExpression') {
if (node.parent && node.parent.parent && node.parent.parent.type !== 'CallExpression' &&
node.parent.parent.type !== 'MemberExpression') {
context.report(node, 'Matcher was not called')
}
}
Expand Down
3 changes: 2 additions & 1 deletion test/rules/valid-expect.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ eslintTester.run('valid-expect', rule, {
valid: [
'expect("something").toEqual("else");',
'expect(true).toBeDefined();',
'expect([1, 2, 3]).toEqual([1, 2, 3]);'
'expect([1, 2, 3]).toEqual([1, 2, 3]);',
'expect(undefined).not.toBeDefined();'
],

invalid: [
Expand Down

0 comments on commit be6454b

Please sign in to comment.