// import React from 'react';
import
{
ICommentItemProps,
CommentItem,
// OwnerTools,
// NonOwnerTools,
// mapDispatchToProps,
// DeletedView,
}
from 'CommentSection/components/CommentItem';
// import { shallowWithIntl } from 'tests/utils/intl';
// import { setFeatures } from 'features';
describe('CommentSection', () => {
const commentProps: ICommentItemProps = {
comment: {
id: '1',
message: 'hi',
createdDate: '1/1/2018',
author: 'Matt',
authorId: 'test',
isOwner: true,
},
divider: true,
key: '1',
};
let props;
beforeAll(() => {
props = { ...commentProps } as unknown as ICommentItemProps;
props.deleteComment = jest.fn();
// setFeatures('COMMENTS', { USER_TAGGING: true, SEND_NOTIFICATIONS: true });
});
afterAll(() => {
// setFeatures('COMMENTS', { USER_TAGGING: false, SEND_NOTIFICATIONS: false });
});
// it('should render the comment', () => {
// const renderedEl = shallowWithIntl();
// expect(renderedEl).toBeDefined();
// });
// it('should render owner comment Tools', () => {
// const renderedEl = shallowWithIntl(
// (
//
// ),
// );
// expect(renderedEl).toBeDefined();
// });
// it('should render nonowner comment Tools', () => {
// const renderedEl = shallowWithIntl(
// (
//
// ),
// );
// expect(renderedEl).toBeDefined();
// });
// it('should render delete state', () => {
// const renderedEl = shallowWithIntl(
// (
//
// ),
// );
// expect(renderedEl).toBeDefined();
// });
it('hitting delete should start delete countdown', () => {
const commentItem = new CommentItem(props);
commentItem.setState = jest.fn();
commentItem['onDelete']();
expect(commentItem.setState).toBeCalledWith(
{ toBeDeleted: true, toBeDeletedComment: props.comment },
);
});
it('hitting undo delete should stop delete countdown', () => {
const commentItem = new CommentItem(props);
commentItem.setState = jest.fn();
commentItem['undoDelete']();
expect(commentItem.setState).toBeCalledWith({ toBeDeleted: false });
});
it('hitting reply should call reply prop', () => {
const commentItem = new CommentItem(props);
props.replyComment = jest.fn();
commentItem['onReply']();
expect(props.replyComment).toBeCalled();
});
// it('should map dispatch actions to properties', () => {
// const dispatch = jest.fn();
// const dispatchProps = mapDispatchToProps(dispatch);
// expect(dispatchProps.deleteComment).toBeDefined();
// expect(dispatchProps.replyComment).toBeDefined();
// dispatchProps.deleteComment({});
// dispatchProps.replyComment({});
// expect(dispatch).toHaveBeenCalledTimes(2);
// });
});