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) { if (testMethod) {
// Start fresh in case of a crash in a previous run. // Start fresh in case of a crash in a previous run.
Realm.clearTestState(); Realm.clearTestState();
console.log("Starting test " + testName);
var promise; var promise;
try { try {
promise = testMethod.call(testSuite); promise = testMethod.call(testSuite);

View File

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