Skip to content

Commit

Permalink
test: add more test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
snitin315 committed Dec 11, 2021
1 parent 95f0084 commit 7e0c12d
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/lib/rules/prefer-object-has-own.js
Expand Up @@ -358,6 +358,28 @@ ruleTester.run("prefer-object-has-own", rule, {
endColumn: 67
}]
},
{
code: "for (const x in{}.hasOwnProperty.call(object, property).toString());",
output: "for (const x in Object.hasOwn(object, property).toString());",
errors: [{
messageId: "useHasOwn",
line: 1,
column: 16,
endLine: 1,
endColumn: 56
}]
},
{
code: "for (const x in/*comment*/{}.hasOwnProperty.call(object, property).toString());",
output: "for (const x in/*comment*/Object.hasOwn(object, property).toString());",
errors: [{
messageId: "useHasOwn",
line: 1,
column: 27,
endLine: 1,
endColumn: 67
}]
},
{
code: "Object['prototype']['hasOwnProperty']['call'](object, property);",
output: "Object.hasOwn(object, property);",
Expand Down

0 comments on commit 7e0c12d

Please sign in to comment.