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 to listen the store
componentDidMount = () => {
...
const deregStoreListener = ConceptStore.listen(
({nodes,centroids}) => {
...
}
)
}
it throw error
TypeError: _index2.default.listen is not a function
The strange behavior is that init function wasn't called. So Reflux.createStore didn't created store properly. Why?