Skip to content

Commit

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

Please sign in to comment.