From 1aec51cfae0cf1279a94d9d34e99d8ba6d550727 Mon Sep 17 00:00:00 2001 From: blagoev Date: Thu, 6 Apr 2017 11:00:29 +0300 Subject: [PATCH] fix tests not completing on failure --- tests/js/index.js | 2 +- tests/js/user-tests.js | 12 +++--------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/tests/js/index.js b/tests/js/index.js index 52f3af1e..5ad9b114 100644 --- a/tests/js/index.js +++ b/tests/js/index.js @@ -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); diff --git a/tests/js/user-tests.js b/tests/js/user-tests.js index 56eba1a2..91c0a250 100644 --- a/tests/js/user-tests.js +++ b/tests/js/user-tests.js @@ -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() {