MM-61893 Replace usage of hasOwnProperty with Object.hasOwn (#29428)

* MM-61893 Replace usage of hasOwnProperty with Object.hasOwn

* Update type guard in messageToElement

* Replace a couple more hasOwnProperty calls
Этот коммит содержится в:
Harrison Healey
2024-12-03 16:53:23 -05:00
коммит произвёл GitHub
родитель 3ed209a34d
Коммит 8533350a91
38 изменённых файлов: 69 добавлений и 69 удалений

Просмотреть файл

@@ -152,11 +152,11 @@ function waitForServerStatus(pluginId, version, state = {}) {
const checkFn = () => {
cy.log(`Waiting for ${pluginId}`);
return cy.apiGetPluginStatus(pluginId, version).then((status) => {
if (state.hasOwnProperty('isActive')) {
if (Object.hasOwn(state, 'isActive')) {
return state.isActive === status.isActive;
}
if (state.hasOwnProperty('isInstalled')) {
if (Object.hasOwn(state, 'isInstalled')) {
return state.isInstalled === status.isInstalled;
}

Просмотреть файл

@@ -146,7 +146,7 @@ const expectConfigToBeUpdatable = (currentConfig, newConfig) => {
if (setting) {
Object.keys(newSubSetting).forEach((newSubKey) => {
const isAvailable = setting.hasOwnProperty(newSubKey);
const isAvailable = Object.hasOwn(setting, newSubKey);
const name = `${newMainKey}.${newSubKey}`;
expect(isAvailable, isAvailable ? `${name} setting can be updated.` : errorMessage(name)).to.equal(true);
});

Просмотреть файл

@@ -15,7 +15,7 @@ function getTestName() {
const testTitles = [];
function extractTitles(obj) {
if (obj.hasOwnProperty('parent')) {
if (Object.hasOwn(obj, 'parent')) {
testTitles.push(obj.title);
const nextObj = obj.parent;
extractTitles(nextObj);

Просмотреть файл

@@ -149,7 +149,7 @@ function removeFromFiles(files = {}, filesToRemove = []) {
const removedFiles = intersection(Object.keys(testFilesObject), filesToRemove);
removedFiles.forEach((file) => {
if (testFilesObject.hasOwnProperty(file)) {
if (Object.hasOwn(testFilesObject, file)) {
delete testFilesObject[file];
}
});