Commit c24e7227 authored by JC Brand's avatar JC Brand

Fix testing bug where all subsequent tests after a timed out test also time out

parent d58380af
...@@ -250,11 +250,11 @@ ...@@ -250,11 +250,11 @@
return _converse; return _converse;
} }
mock.initConverse = function (spies, promise_names=null, settings=null, func) { mock.initConverse = function (spies, promise_names=[], settings=null, func) {
if (_.isFunction(spies)) { if (_.isFunction(spies)) {
func = spies; func = spies;
spies = null; spies = null;
promise_names = null promise_names = []
settings = null; settings = null;
} }
return async done => { return async done => {
...@@ -263,9 +263,8 @@ ...@@ -263,9 +263,8 @@
_converse.api.user.logout(); _converse.api.user.logout();
done(); done();
} }
const promises = _.map(promise_names, _converse.api.waitUntil); await Promise.all(promise_names.map(_converse.api.waitUntil));
await Promise.all(promises); func(_done, _converse).catch(e => { fail(e); _done(); });
func(_done, _converse);
} }
}; };
return mock; return mock;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment