Skip to content

Commit 6032b34

Browse files
committed
fix(test): replace hasOwnProperty with Object.hasOwn
Replace deprecated .hasOwnProperty() calls with modern Object.hasOwn() method to fix lint warnings.
1 parent 6278034 commit 6032b34

1 file changed

Lines changed: 4 additions & 10 deletions

File tree

test/utils/get-ipc.test.ts

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,7 @@ describe('utils/get-ipc', () => {
3131
})
3232

3333
it('should return same reference every time', async () => {
34-
const results = await Promise.all([
35-
getIpc(),
36-
getIpc(),
37-
getIpc(),
38-
])
34+
const results = await Promise.all([getIpc(), getIpc(), getIpc()])
3935
expect(results[0]).toBe(results[1])
4036
expect(results[1]).toBe(results[2])
4137
})
@@ -218,9 +214,7 @@ describe('utils/get-ipc', () => {
218214
const keys = Object.keys(ipc) as Array<keyof IpcObject>
219215

220216
if (keys.length > 0) {
221-
const results = await Promise.all(
222-
keys.map(key => getIpc(key))
223-
)
217+
const results = await Promise.all(keys.map(key => getIpc(key)))
224218

225219
results.forEach((result, i) => {
226220
expect(result).toBe(ipc[keys[i]])
@@ -302,15 +296,15 @@ describe('utils/get-ipc', () => {
302296
const keys = Object.keys(ipc)
303297

304298
keys.forEach(key => {
305-
expect(ipc.hasOwnProperty(key)).toBe(true)
299+
expect(Object.hasOwn(ipc, key)).toBe(true)
306300
})
307301
})
308302

309303
it('should not have prototype pollution', async () => {
310304
const ipc = await getIpc()
311305

312306
expect('toString' in ipc).toBe(true) // inherited
313-
expect(ipc.hasOwnProperty('toString')).toBe(false) // not own property
307+
expect(Object.hasOwn(ipc, 'toString')).toBe(false) // not own property
314308
})
315309
})
316310
})

0 commit comments

Comments
 (0)