import React from 'react' import { fireEvent, render, screen } from '@testing-library/react' import { Caption } from './index' describe('Review/Caption', () => { it('should render the date', () => { render(08th August 2017) expect(screen.getByText('08th August 2017')).toBeInTheDocument() }) it('should render a link', () => { const onClick = jest.fn() render( 08th August 2017 , ) expect(screen.getByRole('link', { name: 'Reply' })).toBeInTheDocument() fireEvent.click(screen.getByRole('link', { name: 'Reply' })) expect(onClick).toHaveBeenCalled() }) })