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 .
This commit is contained in:
Gerhard de Clercq 2018-03-21 19:44:57 +02:00 committed by GitHub
parent c370ef4d86
commit 7152afddd9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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.