Skip to content

Commit a00f44c

Browse files
authoredApr 9, 2023
feat: updated smoke tests (#150)
1 parent 903608c commit a00f44c

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed
 

‎src/rules/prefer-comparison-matcher.test.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ describe(RULE_NAME, () => {
1818
'expect(a !== "string").toStrictEqual(true)',
1919
'expect(5 != a).toBe(true)',
2020
'expect(a == "string").toBe(true)',
21-
'expect(a == "string").not.toBe(true)'
21+
'expect(a == "string").not.toBe(true)',
22+
'expect().fail(\'Should not succeed a HTTPS proxy request.\');'
2223
],
2324
invalid: [
2425
{

‎src/rules/prefer-comparison-matcher.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ type MESSAGE_IDS = 'useToBeComparison';
99
type Options = []
1010

1111
const isString = (node: TSESTree.Node) => {
12-
return isStringNode(node) || node.type === AST_NODE_TYPES.TemplateLiteral
12+
return isStringNode(node) || node?.type === AST_NODE_TYPES.TemplateLiteral
1313
}
1414

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

85-
if (comparison.type !== AST_NODE_TYPES.BinaryExpression ||
85+
if (comparison?.type !== AST_NODE_TYPES.BinaryExpression ||
8686
isComparingToString(comparison) ||
8787
// eslint-disable-next-line no-prototype-builtins
8888
!EqualityMatcher.hasOwnProperty(getAccessorValue(matcher)) ||

0 commit comments

Comments
 (0)
Please sign in to comment.