creating a Realm.Sync.initialiize()

This commit is contained in:
Kenneth Geisshirt 2017-09-27 15:56:09 +02:00
commit 87ab6dd6d3
5 changed files with 13 additions and 24 deletions

View File

@ -2,4 +2,4 @@ PACKAGE_NAME=realm-js
VERSION=2.0.0-rc11
REALM_CORE_VERSION=3.2.1
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

View File

@ -276,7 +276,7 @@ const instanceMethods = {
retrieveAccount(provider, provider_id) {
checkTypes(arguments, ['string', 'string']);
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 = {
Authorization: this.token
};

View File

@ -1,7 +1,5 @@
#!/bin/bash
exit 0
set -eo pipefail
[ "$(uname -s)" != "Darwin" ] && exit

View File

@ -20,8 +20,7 @@
const Realm = require('realm');
// FIXME: sync testing needs to be updated for ROS 2.0
global.enableSyncTests = Realm.Sync && false;
global.enableSyncTests = Realm.Sync;
var TESTS = {
ListTests: require('./list-tests'),
@ -47,7 +46,6 @@ if (global.enableSyncTests) {
// FIXME: Permission tests currently fail in chrome debugging mode.
if (typeof navigator === 'undefined' ||
!/Chrome/.test(navigator.userAgent)) { // eslint-disable-line no-undef
//TESTS.PermissionTests = require('./permission-tests');
}
}

View File

@ -130,7 +130,7 @@ module.exports = {
Realm.Sync.User.register('http://localhost:9080', username, 'password', (error, user) => {
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);
resolve();
} catch(e) {
@ -209,7 +209,7 @@ module.exports = {
testLoginNonExistingUser() {
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);
});
},
@ -322,20 +322,10 @@ module.exports = {
user.retrieveAccount('password', global.testAdminUserInfo.username)
.then(account => {
// {
// "provider_id": "admin",
// "provider": "password",
// "user": {
// "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);
TestCase.assertEqual(account.accounts[0].provider_id, global.testAdminUserInfo.username);
TestCase.assertEqual(account.accounts[0].provider, 'password');
TestCase.assertTrue(account.is_admin);
TestCase.assertTrue(account.user_id);
resolve();
})
.catch(e => reject(e));
@ -367,7 +357,10 @@ module.exports = {
})
.catch(e => {
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) {
reject(e);