fix users tests (account tests still fail)
This commit is contained in:
parent
b7fef1b6e9
commit
0f1d916874
|
@ -123,13 +123,20 @@ module.exports = {
|
|||
|
||||
testRegisterExistingUser() {
|
||||
var username = uuid();
|
||||
return callbackTest((callback) => Realm.Sync.User.register('http://localhost:9080', username, 'password', callback), (error, user) => {
|
||||
failOnError(error);
|
||||
assertIsUser(user);
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
Realm.Sync.User.register('http://localhost:9080', username, 'password', (error, user) => {
|
||||
assertIsAuthError(error, 611, "The provided credentials are invalid or a user already exists.");
|
||||
TestCase.assertUndefined(user);
|
||||
failOnError(error);
|
||||
assertIsUser(user);
|
||||
|
||||
Realm.Sync.User.register('http://localhost:9080', username, 'password', (error, user) => {
|
||||
try {
|
||||
assertIsAuthError(error, 613, "The account cannot be registered as it exists already.");
|
||||
TestCase.assertUndefined(user);
|
||||
resolve();
|
||||
} catch(e) {
|
||||
reject(e);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
},
|
||||
|
@ -202,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 or a user already exists.");
|
||||
assertIsAuthError(error, 611, "The provided credentials are invalid.");
|
||||
TestCase.assertUndefined(user);
|
||||
});
|
||||
},
|
||||
|
@ -359,7 +366,12 @@ module.exports = {
|
|||
reject("Retrieving not existing account should fail");
|
||||
})
|
||||
.catch(e => {
|
||||
TestCase.assertEqual(e.code, 404);
|
||||
try {
|
||||
TestCase.assertEqual(e.code, 404);
|
||||
}
|
||||
catch (e) {
|
||||
reject(e);
|
||||
}
|
||||
resolve()
|
||||
});
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue