diff --git a/packages/utils/testing/src/embark.js b/packages/utils/testing/src/embark.js index 19656a762..071f243a8 100644 --- a/packages/utils/testing/src/embark.js +++ b/packages/utils/testing/src/embark.js @@ -26,8 +26,8 @@ class Embark { this.plugins.registerAPICall(method, endpoint, callback); } - registerActionForEvent(name, cb) { - this.plugins.registerActionForEvent(name, cb); + registerActionForEvent(name, options, cb) { + this.plugins.registerActionForEvent(name, options, cb); } registerConsoleCommand(options) { diff --git a/packages/utils/testing/src/plugin.js b/packages/utils/testing/src/plugin.js index 27c6d94fe..b1a846808 100644 --- a/packages/utils/testing/src/plugin.js +++ b/packages/utils/testing/src/plugin.js @@ -33,8 +33,8 @@ class Plugins { } } - registerActionForEvent(name, cb) { - this.plugin.registerActionForEvent(name, cb); + registerActionForEvent(name, options, cb) { + this.plugin.registerActionForEvent(name, options, cb); } registerAPICall(method, endpoint, callback) { @@ -76,7 +76,11 @@ class Plugin { return this.listeners[name]; } - registerActionForEvent(name, action) { + registerActionForEvent(name, options, action) { + if (typeof options === 'function') { + action = options; + } + if (!this.listeners[name]) { this.listeners[name] = []; }