Skip to content

Commit 15acb86

Browse files
committed
Cleanup overwriting globals tests.
1 parent d577412 commit 15acb86

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

test/misc-tests.js

+7-8
Original file line numberDiff line numberDiff line change
@@ -257,10 +257,11 @@ describe("miscellaneous tests", () => {
257257
})
258258

259259
it("should support overwriting globals", () => {
260+
const { defineProperty } = Reflect
260261
const consoleDescriptor = Reflect.getOwnPropertyDescriptor(global, "console")
261262
const reflectDescriptor = Reflect.getOwnPropertyDescriptor(global, "Reflect")
262263

263-
Reflect.defineProperty(global, "console", {
264+
defineProperty(global, "console", {
264265
configurable: true,
265266
value: {
266267
dir() {
@@ -270,7 +271,7 @@ describe("miscellaneous tests", () => {
270271
writable: true
271272
})
272273

273-
Reflect.defineProperty(global, "Reflect", {
274+
defineProperty(global, "Reflect", {
274275
configurable: true,
275276
value: {
276277
get() {
@@ -280,15 +281,13 @@ describe("miscellaneous tests", () => {
280281
writable: true
281282
})
282283

283-
const object = {}
284-
285284
const actual = [
286-
console.dir(object),
287-
Reflect.get(object, "a")
285+
console.dir({}),
286+
Reflect.get({}, "a")
288287
]
289288

290-
Object.defineProperty(global, "console", consoleDescriptor)
291-
Object.defineProperty(global, "Reflect", reflectDescriptor)
289+
defineProperty(global, "console", consoleDescriptor)
290+
defineProperty(global, "Reflect", reflectDescriptor)
292291

293292
assert.deepStrictEqual(actual, ["mock", "mock"])
294293
})

0 commit comments

Comments
 (0)