From c24e72272b81ffc56aca66c45b00151e354b1713 Mon Sep 17 00:00:00 2001 From: JC Brand Date: Thu, 12 Sep 2019 18:50:30 +0200 Subject: [PATCH] Fix testing bug where all subsequent tests after a timed out test also time out --- tests/mock.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tests/mock.js b/tests/mock.js index 4f81f470b..5b44d6a1c 100644 --- a/tests/mock.js +++ b/tests/mock.js @@ -250,11 +250,11 @@ return _converse; } - mock.initConverse = function (spies, promise_names=null, settings=null, func) { + mock.initConverse = function (spies, promise_names=[], settings=null, func) { if (_.isFunction(spies)) { func = spies; spies = null; - promise_names = null + promise_names = [] settings = null; } return async done => { @@ -263,9 +263,8 @@ _converse.api.user.logout(); done(); } - const promises = _.map(promise_names, _converse.api.waitUntil); - await Promise.all(promises); - func(_done, _converse); + await Promise.all(promise_names.map(_converse.api.waitUntil)); + func(_done, _converse).catch(e => { fail(e); _done(); }); } }; return mock;