import { fetchCommentsBeginAction, fetchCommentsSuccessAction, fetchUsersBeginAction, createCommentBeginAction, } from 'CommentSection/actions'; import * as ActionTypes from 'CommentSection/constants'; import { action } from 'typesafe-actions'; describe('RegMon actions', () => { describe('fetchCommentsBeginAction', () => { it('should return expected results', () => { const data = 'testData'; expect(fetchCommentsBeginAction(data)) .toEqual(action(ActionTypes.FETCH_COMMENTS_BEGIN, { threadId: data })); }); }); describe('fetchCommentsSuccessAction', () => { it('should return expected results', () => { const data = [ { id: '1', message: '2', author: '3', authorId: '5', createdDate: '4', isOwner: false, }, ]; expect(fetchCommentsSuccessAction(data)) .toEqual(action(ActionTypes.FETCH_COMMENTS_SUCCESS, { comments: data })); }); }); describe('createCommentBeginAction', () => { it('should return expected results', () => { const data = { id: '1', message: '2', author: '3', authorId: '5', createdDate: '4', isOwner: false, }; expect(createCommentBeginAction(data)) .toEqual(action(ActionTypes.CREATE_COMMENT_BEGIN, { comment: data })); }); }); describe('fetchUsersBeginAction', () => { it('should return expected results', () => { expect(fetchUsersBeginAction()) .toEqual(action(ActionTypes.FETCH_USERS_BEGIN)); }); }); });