Skip to content

Commit

Permalink
fix: add guard for missing assertion invocation (#58)
Browse files Browse the repository at this point in the history
  • Loading branch information
tinovyatkin authored and SimenB committed Dec 3, 2018
1 parent ff34315 commit 73c9187
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions rules/__tests__/prefer-to-be-null.test.js
Expand Up @@ -18,6 +18,7 @@ ruleTester.run('prefer-to-be-null', rule, {
'expect("a string").toMatchSnapshot(null);',
'expect("a string").not.toMatchSnapshot();',
"expect(something).toEqual('a string');",
'expect(null).toBe',
],

invalid: [
Expand Down
1 change: 1 addition & 0 deletions rules/__tests__/prefer-to-be-undefined.test.js
Expand Up @@ -15,6 +15,7 @@ ruleTester.run('prefer-to-be-undefined', rule, {
'expect(something).toEqual(somethingElse)',
'expect(something).not.toBe(somethingElse)',
'expect(something).not.toEqual(somethingElse)',
'expect(undefined).toBe',
],

invalid: [
Expand Down
6 changes: 4 additions & 2 deletions rules/util.js
Expand Up @@ -73,9 +73,11 @@ const methodName = node => method(node).name;

const methodName2 = node => method2(node).name;

const argument = node => node.parent.parent.arguments[0];
const argument = node =>
node.parent.parent.arguments && node.parent.parent.arguments[0];

const argument2 = node => node.parent.parent.parent.arguments[0];
const argument2 = node =>
node.parent.parent.parent.arguments && node.parent.parent.parent.arguments[0];

const describeAliases = Object.assign(Object.create(null), {
describe: true,
Expand Down

0 comments on commit 73c9187

Please sign in to comment.