mirror of
https://github.com/status-im/realm-js.git
synced 2025-02-18 17:47:32 +00:00
Do not throw when the Sync constructor isn’t there (#1086)
* Do not throw when the Sync constructor isn’t there with unified packaging it’s there all the time now Closes #1084 Fixes #996 * Fix running the sync tests when Sync is disabled
This commit is contained in:
parent
30e58022cf
commit
7086ed745f
@ -4,6 +4,7 @@ vNext Release notes (TBD)
|
|||||||
* None
|
* None
|
||||||
|
|
||||||
### Enhancements
|
### Enhancements
|
||||||
|
* Accessing `Realm.Sync` when sync is not enabled will no longer throw, but return `undefined`.
|
||||||
* Better error messages when creating objects.
|
* Better error messages when creating objects.
|
||||||
* Added bundled TypeScript declarations of the Realm API.
|
* Added bundled TypeScript declarations of the Realm API.
|
||||||
|
|
||||||
|
@ -94,12 +94,6 @@ module.exports = function(realmConstructor) {
|
|||||||
|
|
||||||
setConstructorOnPrototype(realmConstructor.Sync.User);
|
setConstructorOnPrototype(realmConstructor.Sync.User);
|
||||||
setConstructorOnPrototype(realmConstructor.Sync.Session);
|
setConstructorOnPrototype(realmConstructor.Sync.Session);
|
||||||
} else {
|
|
||||||
Object.defineProperty(realmConstructor, 'Sync', {
|
|
||||||
get: function () {
|
|
||||||
throw new Error("Realm.Sync is not available. Note that the developer edition of the Node.JS SDK for Realm does not include sync on Linux.");
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Remove this now useless object.
|
// TODO: Remove this now useless object.
|
||||||
|
@ -71,8 +71,7 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
try {
|
if (Realm.Sync) {
|
||||||
Realm.Sync; // this will throw is sync is disabled
|
|
||||||
module.exports.testEncryptionWithSync = function() {
|
module.exports.testEncryptionWithSync = function() {
|
||||||
new Realm({
|
new Realm({
|
||||||
encryptionKey: new Int8Array(64),
|
encryptionKey: new Int8Array(64),
|
||||||
@ -82,4 +81,4 @@ try {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
} catch(e) { }
|
}
|
||||||
|
@ -34,14 +34,8 @@ if (!(typeof process === 'object' && process.platform === 'win32')) {
|
|||||||
TESTS.EncryptionTests = require('./encryption-tests');
|
TESTS.EncryptionTests = require('./encryption-tests');
|
||||||
}
|
}
|
||||||
|
|
||||||
// If sync is enabled, run the user tests
|
// If sync is enabled, run the sync tests
|
||||||
let hasSync = false;
|
if (Realm.Sync) {
|
||||||
try {
|
|
||||||
Realm.Sync; // This will throw if Sync is disabled.
|
|
||||||
hasSync = true;
|
|
||||||
} catch (e) { }
|
|
||||||
|
|
||||||
if (hasSync) {
|
|
||||||
TESTS.UserTests = require('./user-tests');
|
TESTS.UserTests = require('./user-tests');
|
||||||
TESTS.SessionTests = require('./session-tests');
|
TESTS.SessionTests = require('./session-tests');
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user