From 41efa736ee9f5da4d8c6c963be90c4ce6769cef4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Lal?= Date: Sat, 9 Mar 2024 17:35:10 +0100 Subject: [PATCH] Use getPrototypeOf instead of __proto__ (#1592) --- test/datetime/proto.test.js | 2 +- test/duration/proto.test.js | 2 +- test/interval/proto.test.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/test/datetime/proto.test.js b/test/datetime/proto.test.js index bbe132dc4..71fba90f7 100644 --- a/test/datetime/proto.test.js +++ b/test/datetime/proto.test.js @@ -4,6 +4,6 @@ import { DateTime } from "../../src/luxon"; test("DateTime prototype properties should not throw when accessed", () => { const d = DateTime.now(); expect(() => - Object.getOwnPropertyNames(d.__proto__).forEach((name) => d.__proto__[name]) + Object.getOwnPropertyNames(Object.getPrototypeOf(d)).forEach((name) => Object.getPrototypeOf(d)[name]) ).not.toThrow(); }); diff --git a/test/duration/proto.test.js b/test/duration/proto.test.js index aba74c4f4..40132ac96 100644 --- a/test/duration/proto.test.js +++ b/test/duration/proto.test.js @@ -3,6 +3,6 @@ import { Duration } from "../../src/luxon"; test("Duration prototype properties should not throw when addressed", () => { const d = Duration.fromObject({ hours: 1 }); expect(() => - Object.getOwnPropertyNames(d.__proto__).forEach((name) => d.__proto__[name]) + Object.getOwnPropertyNames(Object.getPrototypeOf(d)).forEach((name) => Object.getPrototypeOf(d)[name]) ).not.toThrow(); }); diff --git a/test/interval/proto.test.js b/test/interval/proto.test.js index bcc3e9b30..ddf873ac6 100644 --- a/test/interval/proto.test.js +++ b/test/interval/proto.test.js @@ -4,6 +4,6 @@ import { DateTime } from "../../src/luxon"; test("Interval prototype properties should not throw when addressed", () => { const i = DateTime.fromISO("2018-01-01").until(DateTime.fromISO("2018-01-02")); expect(() => - Object.getOwnPropertyNames(i.__proto__).forEach((name) => i.__proto__[name]) + Object.getOwnPropertyNames(Object.getPrototypeOf(i)).forEach((name) => Object.getPrototypeOf(i)[name]) ).not.toThrow(); });