Skip to content

Commit

Permalink
refactor(no-standalone-expect): remove unneeded check
Browse files Browse the repository at this point in the history
  • Loading branch information
G-Rath committed Apr 10, 2021
1 parent c0c7bef commit ede986c
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions src/rules/no-standalone-expect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
} from '@typescript-eslint/experimental-utils';
import {
DescribeAlias,
TestCaseName,
createRule,
getNodeName,
isDescribeCall,
Expand Down Expand Up @@ -47,14 +46,6 @@ const getBlockType = (
return null;
};

const isEach = (node: TSESTree.CallExpression): boolean =>
node.callee.type === AST_NODE_TYPES.CallExpression &&
node.callee.callee.type === AST_NODE_TYPES.MemberExpression &&
node.callee.callee.property.type === AST_NODE_TYPES.Identifier &&
node.callee.callee.property.name === 'each' &&
node.callee.callee.object.type === AST_NODE_TYPES.Identifier &&
TestCaseName.hasOwnProperty(node.callee.callee.object.name);

type BlockType = 'test' | 'function' | 'describe' | 'arrow' | 'template';

export default createRule<
Expand Down Expand Up @@ -121,9 +112,8 @@ export default createRule<

if (
(top === 'test' &&
(isEach(node) ||
(isTestBlock(node) &&
node.callee.type !== AST_NODE_TYPES.MemberExpression))) ||
isTestBlock(node) &&
node.callee.type !== AST_NODE_TYPES.MemberExpression) ||
(top === 'template' &&
node.callee.type === AST_NODE_TYPES.TaggedTemplateExpression)
) {
Expand Down

0 comments on commit ede986c

Please sign in to comment.