Skip to content

Instantly share code, notes, and snippets.

@smashercosmo
Created June 28, 2016 17:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save smashercosmo/6b4568cbc0a19a29550334ce0ea95ebb to your computer and use it in GitHub Desktop.
Save smashercosmo/6b4568cbc0a19a29550334ce0ea95ebb to your computer and use it in GitHub Desktop.
export function fetchUser(id) {
return (dispatch, getState, {analytics, api}) => {
return api.fetchUser().then(user => {
analytics.track(...);
})
}
}
import {fetchUser} from './user.actions';
describe('fetchUser', () => {
it('should fetch user', () => {
fetchUser('1')(mockDispatch, mockGetState, {api: mockApi, analytics: mockAnalytics});
/* your assertions */
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment