diff --git a/dependencies.list b/dependencies.list index 19ec8372..d8a32030 100644 --- a/dependencies.list +++ b/dependencies.list @@ -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 diff --git a/lib/user-methods.js b/lib/user-methods.js index 7296474b..d296f988 100644 --- a/lib/user-methods.js +++ b/lib/user-methods.js @@ -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 }; diff --git a/scripts/download-object-server.sh b/scripts/download-object-server.sh index d48c77f5..bca57c0a 100755 --- a/scripts/download-object-server.sh +++ b/scripts/download-object-server.sh @@ -1,7 +1,5 @@ #!/bin/bash -exit 0 - set -eo pipefail [ "$(uname -s)" != "Darwin" ] && exit diff --git a/tests/js/index.js b/tests/js/index.js index 4caf6c70..40b9af42 100644 --- a/tests/js/index.js +++ b/tests/js/index.js @@ -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'); } } diff --git a/tests/js/user-tests.js b/tests/js/user-tests.js index 0cd6c703..6c7727d8 100644 --- a/tests/js/user-tests.js +++ b/tests/js/user-tests.js @@ -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);