From 7152afddd94982776d27a00a13afdead934faaf1 Mon Sep 17 00:00:00 2001 From: Gerhard de Clercq Date: Wed, 21 Mar 2018 19:44:57 +0200 Subject: [PATCH] Stop Permissions being redefined and breaking Jest Fixes a related problem in exactly the same way as https://github.com/realm/realm-js/pull/1695 . --- lib/extensions.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/extensions.js b/lib/extensions.js index b28ed09c..505bdf51 100644 --- a/lib/extensions.js +++ b/lib/extensions.js @@ -257,10 +257,12 @@ module.exports = function(realmConstructor) { permissions: '__Permission[]' } }); - Object.defineProperty(realmConstructor, 'Permissions', { - value: permissionsSchema, - configurable: false - }); + if (!realmConstructor.Permissions) { + Object.defineProperty(realmConstructor, 'Permissions', { + value: permissionsSchema, + configurable: false + }); + } } // TODO: Remove this now useless object.