Skip to content

Commit

Permalink
feat: updated smoke tests (#150)
Browse files Browse the repository at this point in the history
  • Loading branch information
veritem committed Apr 9, 2023
1 parent 903608c commit a00f44c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/rules/prefer-comparison-matcher.test.ts
Expand Up @@ -18,7 +18,8 @@ describe(RULE_NAME, () => {
'expect(a !== "string").toStrictEqual(true)',
'expect(5 != a).toBe(true)',
'expect(a == "string").toBe(true)',
'expect(a == "string").not.toBe(true)'
'expect(a == "string").not.toBe(true)',
'expect().fail(\'Should not succeed a HTTPS proxy request.\');'
],
invalid: [
{
Expand Down
4 changes: 2 additions & 2 deletions src/rules/prefer-comparison-matcher.ts
Expand Up @@ -9,7 +9,7 @@ type MESSAGE_IDS = 'useToBeComparison';
type Options = []

const isString = (node: TSESTree.Node) => {
return isStringNode(node) || node.type === AST_NODE_TYPES.TemplateLiteral
return isStringNode(node) || node?.type === AST_NODE_TYPES.TemplateLiteral
}

const isComparingToString = (expression: TSESTree.BinaryExpression) => {
Expand Down Expand Up @@ -82,7 +82,7 @@ export default createEslintRule<Options, MESSAGE_IDS>({
const { matcher } = vitestFnCall
const matcherArg = getFirstMatcherArg(vitestFnCall)

if (comparison.type !== AST_NODE_TYPES.BinaryExpression ||
if (comparison?.type !== AST_NODE_TYPES.BinaryExpression ||
isComparingToString(comparison) ||
// eslint-disable-next-line no-prototype-builtins
!EqualityMatcher.hasOwnProperty(getAccessorValue(matcher)) ||
Expand Down

0 comments on commit a00f44c

Please sign in to comment.