mocking - Init function isn't calling when Reflux.createStore -
i have mocked store
var action = reflux.createaction('action'); var mockfn = jest.genmockfn(); var store = reflux.createstore({ init: function () { console.log("init mock"); this.listento(action, this.onaction); }, onaction: function () { mockfn(); } }); export default store;
and when component try listen store
componentdidmount = () => { ... const deregstorelistener = conceptstore.listen( ({nodes,centroids}) => { ... } ) }
it throw error
typeerror: _index2.default.listen not function
the strange behavior init function wasn't called. reflux.createstore didn't created store properly. why?
Comments
Post a Comment