adastra-ui-comment
Version:
Testing locally 1) in this file - `npm i` install dependencies - `npm run build` or `npm run tsc` to build your module 2) in childApp - in package.json under dependencies add ui-astra-assets with file:(relativePathToRepo) - "ui-astra-a
49 lines • 1.88 kB
JavaScript
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));
});
});
});
//# sourceMappingURL=actions.test.js.map