diff --git a/tests/lib/rules/prefer-object-has-own.js b/tests/lib/rules/prefer-object-has-own.js index 814967d985d..64b34eafeed 100644 --- a/tests/lib/rules/prefer-object-has-own.js +++ b/tests/lib/rules/prefer-object-has-own.js @@ -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);",