Skip to content

Commit 73c9187

Browse files
tinovyatkinSimenB
authored andcommitted
fix: add guard for missing assertion invocation (#58)
1 parent ff34315 commit 73c9187

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

rules/__tests__/prefer-to-be-null.test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ ruleTester.run('prefer-to-be-null', rule, {
1818
'expect("a string").toMatchSnapshot(null);',
1919
'expect("a string").not.toMatchSnapshot();',
2020
"expect(something).toEqual('a string');",
21+
'expect(null).toBe',
2122
],
2223

2324
invalid: [

rules/__tests__/prefer-to-be-undefined.test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ ruleTester.run('prefer-to-be-undefined', rule, {
1515
'expect(something).toEqual(somethingElse)',
1616
'expect(something).not.toBe(somethingElse)',
1717
'expect(something).not.toEqual(somethingElse)',
18+
'expect(undefined).toBe',
1819
],
1920

2021
invalid: [

rules/util.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,11 @@ const methodName = node => method(node).name;
7373

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

76-
const argument = node => node.parent.parent.arguments[0];
76+
const argument = node =>
77+
node.parent.parent.arguments && node.parent.parent.arguments[0];
7778

78-
const argument2 = node => node.parent.parent.parent.arguments[0];
79+
const argument2 = node =>
80+
node.parent.parent.parent.arguments && node.parent.parent.parent.arguments[0];
7981

8082
const describeAliases = Object.assign(Object.create(null), {
8183
describe: true,

0 commit comments

Comments
 (0)