score:2

Accepted answer

what you can do is export your component in addition to the default export. so change it to:

export class mycomponent extends component

in your test, you can now import your actual component instead of the connected component. as you have dispatch as a prop of your component, you can supply a mock function or a spy (using something like jasmine or sinon) for dispatch in your test, and you can test if that gets called with the correct parameters.

check out more on redux testing here: http://redux.js.org/docs/recipes/writingtests.html


Related Query

More Query from same tag