fix(utils/testing): ensure runActionsForEvent() works without params object

This commit is contained in:
Pascal Precht 2020-02-17 12:20:10 +01:00 committed by Iuri Matias
parent ef1ec3a606
commit 62a229198b
1 changed files with 5 additions and 0 deletions

View File

@ -20,6 +20,11 @@ class Plugins {
} }
runActionsForEvent(name, options, callback) { runActionsForEvent(name, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
const listeners = this.plugin.getListeners(name); const listeners = this.plugin.getListeners(name);
if (listeners) { if (listeners) {
listeners.forEach(fn => fn.spy(options, callback)); listeners.forEach(fn => fn.spy(options, callback));