test fixes

This commit is contained in:
Ari Lazier 2016-11-08 09:21:27 -08:00
parent fde1c5d00d
commit b2e71a5fb6
2 changed files with 7 additions and 13 deletions

View File

@ -20,7 +20,7 @@ if (typeof fetch != 'undefined') {
}
})
.then((body) => {
callback(undefined, {statusCode: 200}, JSON.parse(body))
callback(undefined, {statusCode: 200}, body)
})
.catch((error) => {
callback(error);
@ -60,8 +60,7 @@ module.exports = function(realmConstructor) {
callback(error);
}
else if (response.statusCode != 200) {
console.log(response.statusCode);
callback(new AuthError('Bad response: ' + response.statusCode));
callback(new AuthError(JSON.parse(body)));
}
else {
// TODO: validate JSON

View File

@ -53,7 +53,6 @@ module.exports = {
return new Promise((resolve, reject) => {
Realm.Sync.User.register('http://localhost:9080', username, 'password', (error, user) => {
TestCase.assertEqual(typeof user, 'object');
Realm.Sync.User.register('http://localhost:9080', username, 'password', (error, user) => {
TestCase.assertTrue(error instanceof Realm.Sync.AuthError);
TestCase.assertEqual(error.code, 613);
@ -69,15 +68,11 @@ module.exports = {
var username = uuid();
return new Promise((resolve, reject) => {
Realm.Sync.User.register('http://localhost:9080', undefined, 'password', (error, user) => {
TestCase.assertEqual(typeof user, 'object');
Realm.Sync.User.register('http://localhost:9080', username, 'password', (error, user) => {
TestCase.assertTrue(error instanceof Realm.Sync.AuthError);
TestCase.assertEqual(error.code, 602);
TestCase.assertEqual(error.type, 'https://realm.io/docs/object-server/problems/missing-parameters');
TestCase.assertEqual(user, undefined);
resolve();
});
TestCase.assertTrue(error instanceof Realm.Sync.AuthError);
TestCase.assertEqual(error.code, 602);
TestCase.assertEqual(error.type, 'https://realm.io/docs/object-server/problems/missing-parameters');
TestCase.assertEqual(user, undefined);
resolve();
});
});
},