gratifyguy / botkit-mock

Write tests for Botkit.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Events not registering for testing `controller.trigger()`

roeintense opened this issue · comments

What I'm doing:

Calling this.controller.loadModule against a feature that I've created in Botkit 4.5 to instantiate a controller with its details.

What's I expect:

this.controller._events should have registered events custom defined in a feature with controller.on(<event_name>)

What I get:

Not that. controller._events is {}.

maybe I'm missing something?

Hey @roeintense ,
I've checked loadModule feature, I replaced fileBeingTested with it
https://github.com/gratifyguy/botkit-mock/blob/master/examples/botkit-slack/tests/slack_features_spec.js#L26-L27`

and passed features folder, as result._events was not empty.

@ihorrusinko I had a chance to look at what you did, and I'm sorry I wasn't more clear. That's how I did it before. When fileBeingTested(this.controller) didn't work, I tried calling LoadModule directly. I'm still not getting event declarations to populate. If you can't get it to replicate easily, it's probably an error on my side. I'll continue to investigate and resubmit if necessary.