fix tests not completing on failure

This commit is contained in:
blagoev 2017-04-06 11:00:29 +03:00
parent c0c54989ec
commit 1aec51cfae
2 changed files with 4 additions and 10 deletions

View File

@ -80,7 +80,7 @@ exports.runTest = function(suiteName, testName) {
if (testMethod) {
// Start fresh in case of a crash in a previous run.
Realm.clearTestState();
console.log("Starting test " + testName);
var promise;
try {
promise = testMethod.call(testSuite);

View File

@ -162,10 +162,9 @@ module.exports = {
},
testLogin() {
return new Promise((resolve, _reject) => {
var username = uuid();
// Create user, logout the new user, then login
callbackTest((callback) => Realm.Sync.User.register('http://localhost:9080', username, 'password', callback), (error, user) => {
return callbackTest((callback) => Realm.Sync.User.register('http://localhost:9080', username, 'password', callback), (error, user) => {
failOnError(error);
user.logout();
@ -180,7 +179,6 @@ module.exports = {
resolve();
});
});
});
},
testLoginMissingUsername() {
@ -226,12 +224,11 @@ module.exports = {
},
testAll() {
return new Promise((resolve, _reject) => {
let all;
all = Realm.Sync.User.all;
TestCase.assertArrayLength(Object.keys(all), 0);
callbackTest((callback) => Realm.Sync.User.register('http://localhost:9080', uuid(), 'password', callback), (error, user1) => {
return callbackTest((callback) => Realm.Sync.User.register('http://localhost:9080', uuid(), 'password', callback), (error, user1) => {
failOnError(error);
all = Realm.Sync.User.all;
@ -259,14 +256,12 @@ module.exports = {
resolve();
});
});
});
},
testCurrent() {
return new Promise((resolve, _reject) => {
TestCase.assertUndefined(Realm.Sync.User.current);
callbackTest((callback) => Realm.Sync.User.register('http://localhost:9080', uuid(), 'password', callback), (error, user1) => {
return callbackTest((callback) => Realm.Sync.User.register('http://localhost:9080', uuid(), 'password', callback), (error, user1) => {
failOnError(error);
assertIsSameUser(Realm.Sync.User.current, user1);
@ -283,7 +278,6 @@ module.exports = {
resolve();
});
});
});
},
testManagementRealm() {