Merge pull request #851 from realm/rt/fix-for-node-server-sdk

Fix loading the Realm constructor for the node-server-sdk
This commit is contained in:
Radu Tutueanu 2017-02-08 17:19:27 +01:00 committed by GitHub
commit 6a076efa95
3 changed files with 5 additions and 6 deletions

View File

@ -45,6 +45,7 @@ module.exports = function(realmConstructor) {
let userMethods = require('./user-methods');
Object.defineProperties(realmConstructor.Sync.User, getOwnPropertyDescriptors(userMethods.static));
Object.defineProperties(realmConstructor.Sync.User.prototype, getOwnPropertyDescriptors(userMethods.instance));
Object.defineProperty(realmConstructor.Sync.User, '_realmConstructor', { value: realmConstructor });
realmConstructor.Sync.AuthError = require('./errors').AuthError;

View File

@ -179,8 +179,7 @@ module.exports = {
url.set('pathname', '/~/__management');
const realmConstructor = require('./index');
return new realmConstructor({
return new this.constructor._realmConstructor({
schema: require('./management-schema'),
sync: {
user: this,

View File

@ -66,10 +66,9 @@ module.exports = {
TestCase.assertEqual(session.state, 'active');
// give the session enough time to refresh its access token and bind itself
let timeout = 500;
if (typeof window !== 'undefined') {
timeout = 2500; // need a longer timeout under React Native because remote debugging
}
// TODO: Use an event to discover when the session is bound
let timeout = 3000;
return wait(timeout).then(() => {
TestCase.assertEqual(session.url, `realm://localhost:9080/${user.identity}/myrealm`);
});