diff --git a/packages/interactions/__tests__/Interactions-unit-test.ts b/packages/interactions/__tests__/Interactions-unit-test.ts index a7b27a7d7c6..87fe5c2aa25 100644 --- a/packages/interactions/__tests__/Interactions-unit-test.ts +++ b/packages/interactions/__tests__/Interactions-unit-test.ts @@ -363,13 +363,6 @@ describe('Interactions', () => { expect.assertions(4); }); - test('Add a invalid pluggable', () => { - expect(() => interactions.addPluggable(new WrongProvider())).toThrow( - 'Invalid pluggable' - ); - expect.assertions(1); - }); - test('Add existing pluggable again', () => { interactions.addPluggable(new DummyProvider()); expect(() => { diff --git a/packages/interactions/src/Interactions.ts b/packages/interactions/src/Interactions.ts index 44a1626bbe6..dbd39c21713 100644 --- a/packages/interactions/src/Interactions.ts +++ b/packages/interactions/src/Interactions.ts @@ -90,29 +90,27 @@ export class InteractionsClass { } public addPluggable(pluggable: InteractionsProvider) { - if (!(pluggable && pluggable.getCategory() === 'Interactions')) { - throw new Error('Invalid pluggable'); - } - - if (!this._pluggables[pluggable.getProviderName()]) { - // configure bots for the new plugin - Object.keys(this._options.bots) - .filter( - botKey => - this._options.bots[botKey].providerName === - pluggable.getProviderName() - ) - .forEach(botKey => { - const bot = this._options.bots[botKey]; - pluggable.configure({ [bot.name]: bot }); - }); - - this._pluggables[pluggable.getProviderName()] = pluggable; - return; - } else { - throw new Error( - 'Pluggable ' + pluggable.getProviderName() + ' already plugged' - ); + if (pluggable && pluggable.getCategory() === 'Interactions') { + if (!this._pluggables[pluggable.getProviderName()]) { + // configure bots for the new plugin + Object.keys(this._options.bots) + .filter( + botKey => + this._options.bots[botKey].providerName === + pluggable.getProviderName() + ) + .forEach(botKey => { + const bot = this._options.bots[botKey]; + pluggable.configure({ [bot.name]: bot }); + }); + + this._pluggables[pluggable.getProviderName()] = pluggable; + return; + } else { + throw new Error( + 'Pluggable ' + pluggable.getProviderName() + ' already plugged' + ); + } } }