Skip to content

Commit 5a35cef

Browse files
committed
Fix: eq check when test case is not object.
1 parent 25ade00 commit 5a35cef

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/rules/no-identical-tests.js

+8
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,14 @@ module.exports = {
3737
*@returns {boolean} if eq, return true, else return false.
3838
*/
3939
function eq (ta, tb) {
40+
if (ta.type !== tb.type) {
41+
return false;
42+
}
43+
44+
if (ta.type !== 'ObjectExpression') {
45+
return sourceCode.getText(ta) === sourceCode.getText(tb);
46+
}
47+
4048
const pa = ta.properties || [];
4149
const pb = tb.properties || [];
4250

0 commit comments

Comments
 (0)