fix(utils/testing): teach testing APIs request options

This commit is contained in:
Pascal Precht 2020-03-30 12:32:47 +02:00
parent deb682c9d2
commit 4199124e40
No known key found for this signature in database
GPG Key ID: 0EE28D8D6FD85D7D
2 changed files with 9 additions and 5 deletions

View File

@ -26,8 +26,8 @@ class Embark {
this.plugins.registerAPICall(method, endpoint, callback); this.plugins.registerAPICall(method, endpoint, callback);
} }
registerActionForEvent(name, cb) { registerActionForEvent(name, options, cb) {
this.plugins.registerActionForEvent(name, cb); this.plugins.registerActionForEvent(name, options, cb);
} }
registerConsoleCommand(options) { registerConsoleCommand(options) {

View File

@ -33,8 +33,8 @@ class Plugins {
} }
} }
registerActionForEvent(name, cb) { registerActionForEvent(name, options, cb) {
this.plugin.registerActionForEvent(name, cb); this.plugin.registerActionForEvent(name, options, cb);
} }
registerAPICall(method, endpoint, callback) { registerAPICall(method, endpoint, callback) {
@ -76,7 +76,11 @@ class Plugin {
return this.listeners[name]; return this.listeners[name];
} }
registerActionForEvent(name, action) { registerActionForEvent(name, options, action) {
if (typeof options === 'function') {
action = options;
}
if (!this.listeners[name]) { if (!this.listeners[name]) {
this.listeners[name] = []; this.listeners[name] = [];
} }