Created
June 7, 2017 02:27
-
-
Save acr13/ae42cfb95bb01c5630cd2eac6acd7293 to your computer and use it in GitHub Desktop.
Simple Saga Test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { call, put } from 'redux-saga/effects'; | |
| import { API_BUTTON_CLICK_SUCCESS, } from './actions/consts'; | |
| import { getDataFromAPI } from './api'; | |
| it('apiSideEffect - fetches data from API and dispatches a success action', () => { | |
| const generator = apiSideEffect(); | |
| expect(generator.next().value) | |
| .toEqual(call(getDataFromAPI)); | |
| expect(generator.next().value) | |
| .toEqual(put({ type: API_BUTTON_CLICK_SUCCESS })); | |
| expect(generator.next()) | |
| .toEqual({ done: true, value: undefined }); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment