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

Popular posts from this blog

gridview - Yii2 DataPorivider $totalSum for a column -

java - Suppress Jboss version details from HTTP error response -

Sass watch command compiles .scss files before full sftp upload -