diff --git a/src/app/store/helpers/makeActionCreator/makeActionCreator.test.js b/src/app/store/helpers/makeActionCreator/makeActionCreator.test.js index 87270d8f..94f9078a 100644 --- a/src/app/store/helpers/makeActionCreator/makeActionCreator.test.js +++ b/src/app/store/helpers/makeActionCreator/makeActionCreator.test.js @@ -3,15 +3,25 @@ import makeActionCreator from './makeActionCreator'; describe('makeActionCreator', () => { const GET_INFO = 'GET_INFO'; + const name = { name: 'Jero' }; it('should return an action creator', () => { - const actionCreation = makeActionCreator(GET_INFO, 'user'); - expect(typeof actionCreation).toBe('function'); + const actionCreator = makeActionCreator(GET_INFO, 'user'); + expect(typeof actionCreator).toBe('function'); }); it('should return an action when calling the action creator', () => { - const actionCreation = makeActionCreator(GET_INFO, 'user'); - const action = actionCreation({ name: 'Jero' }); + const actionCreator = makeActionCreator(GET_INFO, 'user'); + const action = actionCreator(name); expect(action).toEqual(expect.objectContaining({ type: GET_INFO })); }); + + it('should contain action\'s data under "payload" property', () => { + const actionCreator = makeActionCreator(GET_INFO, 'user'); + const action = actionCreator(name); + const payload = { user: name }; + const expectedData = { type: GET_INFO, payload }; + expect(action).toHaveProperty('payload'); + expect(action).toEqual(expectedData); + }); });