mirror of
https://github.com/status-im/realm-js.git
synced 2025-02-18 17:47:32 +00:00
creating a Realm.Sync.initialiize()
This commit is contained in:
commit
87ab6dd6d3
@ -2,4 +2,4 @@ PACKAGE_NAME=realm-js
|
|||||||
VERSION=2.0.0-rc11
|
VERSION=2.0.0-rc11
|
||||||
REALM_CORE_VERSION=3.2.1
|
REALM_CORE_VERSION=3.2.1
|
||||||
REALM_SYNC_VERSION=2.0.0-rc24
|
REALM_SYNC_VERSION=2.0.0-rc24
|
||||||
REALM_OBJECT_SERVER_VERSION=2.0.0-alpha.32
|
REALM_OBJECT_SERVER_VERSION=2.0.0-alpha.36
|
||||||
|
@ -276,7 +276,7 @@ const instanceMethods = {
|
|||||||
retrieveAccount(provider, provider_id) {
|
retrieveAccount(provider, provider_id) {
|
||||||
checkTypes(arguments, ['string', 'string']);
|
checkTypes(arguments, ['string', 'string']);
|
||||||
const url = url_parse(this.server);
|
const url = url_parse(this.server);
|
||||||
url.set('pathname', `/api/providers/${provider}/accounts/${provider_id}`);
|
url.set('pathname', `/auth/users/${provider}/${provider_id}`);
|
||||||
const headers = {
|
const headers = {
|
||||||
Authorization: this.token
|
Authorization: this.token
|
||||||
};
|
};
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
exit 0
|
|
||||||
|
|
||||||
set -eo pipefail
|
set -eo pipefail
|
||||||
|
|
||||||
[ "$(uname -s)" != "Darwin" ] && exit
|
[ "$(uname -s)" != "Darwin" ] && exit
|
||||||
|
@ -20,8 +20,7 @@
|
|||||||
|
|
||||||
const Realm = require('realm');
|
const Realm = require('realm');
|
||||||
|
|
||||||
// FIXME: sync testing needs to be updated for ROS 2.0
|
global.enableSyncTests = Realm.Sync;
|
||||||
global.enableSyncTests = Realm.Sync && false;
|
|
||||||
|
|
||||||
var TESTS = {
|
var TESTS = {
|
||||||
ListTests: require('./list-tests'),
|
ListTests: require('./list-tests'),
|
||||||
@ -47,7 +46,6 @@ if (global.enableSyncTests) {
|
|||||||
// FIXME: Permission tests currently fail in chrome debugging mode.
|
// FIXME: Permission tests currently fail in chrome debugging mode.
|
||||||
if (typeof navigator === 'undefined' ||
|
if (typeof navigator === 'undefined' ||
|
||||||
!/Chrome/.test(navigator.userAgent)) { // eslint-disable-line no-undef
|
!/Chrome/.test(navigator.userAgent)) { // eslint-disable-line no-undef
|
||||||
|
|
||||||
//TESTS.PermissionTests = require('./permission-tests');
|
//TESTS.PermissionTests = require('./permission-tests');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -130,7 +130,7 @@ module.exports = {
|
|||||||
|
|
||||||
Realm.Sync.User.register('http://localhost:9080', username, 'password', (error, user) => {
|
Realm.Sync.User.register('http://localhost:9080', username, 'password', (error, user) => {
|
||||||
try {
|
try {
|
||||||
assertIsAuthError(error, 613, "The account cannot be registered as it exists already.");
|
assertIsAuthError(error, 611, "The provided credentials are invalid or the user does not exist.");
|
||||||
TestCase.assertUndefined(user);
|
TestCase.assertUndefined(user);
|
||||||
resolve();
|
resolve();
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
@ -209,7 +209,7 @@ module.exports = {
|
|||||||
|
|
||||||
testLoginNonExistingUser() {
|
testLoginNonExistingUser() {
|
||||||
return callbackTest((callback) => Realm.Sync.User.login('http://localhost:9080', 'does_not', 'exist', callback), (error, user) => {
|
return callbackTest((callback) => Realm.Sync.User.login('http://localhost:9080', 'does_not', 'exist', callback), (error, user) => {
|
||||||
assertIsAuthError(error, 611, "The provided credentials are invalid.");
|
assertIsAuthError(error, 611, "The provided credentials are invalid or the user does not exist.");
|
||||||
TestCase.assertUndefined(user);
|
TestCase.assertUndefined(user);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -322,20 +322,10 @@ module.exports = {
|
|||||||
|
|
||||||
user.retrieveAccount('password', global.testAdminUserInfo.username)
|
user.retrieveAccount('password', global.testAdminUserInfo.username)
|
||||||
.then(account => {
|
.then(account => {
|
||||||
// {
|
TestCase.assertEqual(account.accounts[0].provider_id, global.testAdminUserInfo.username);
|
||||||
// "provider_id": "admin",
|
TestCase.assertEqual(account.accounts[0].provider, 'password');
|
||||||
// "provider": "password",
|
TestCase.assertTrue(account.is_admin);
|
||||||
// "user": {
|
TestCase.assertTrue(account.user_id);
|
||||||
// "id": "07ac9a0a-a97a-4ee1-b53c-b05a6542035a",
|
|
||||||
// "isAdmin": true,
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
TestCase.assertEqual(account.provider_id, global.testAdminUserInfo.username);
|
|
||||||
TestCase.assertEqual(account.provider, 'password');
|
|
||||||
TestCase.assertTrue(account.user);
|
|
||||||
TestCase.assertTrue(account.user.isAdmin !== undefined);
|
|
||||||
TestCase.assertTrue(account.user.id);
|
|
||||||
resolve();
|
resolve();
|
||||||
})
|
})
|
||||||
.catch(e => reject(e));
|
.catch(e => reject(e));
|
||||||
@ -367,7 +357,10 @@ module.exports = {
|
|||||||
})
|
})
|
||||||
.catch(e => {
|
.catch(e => {
|
||||||
try {
|
try {
|
||||||
TestCase.assertEqual(e.code, 404);
|
TestCase.assertEqual(e.status, 404);
|
||||||
|
TestCase.assertEqual(e.code, 612);
|
||||||
|
TestCase.assertEqual(e.message, "The account does not exist.");
|
||||||
|
TestCase.assertEqual(e.type, "https://realm.io/docs/object-server/problems/unknown-account");
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
reject(e);
|
reject(e);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user