import React from 'react'; import { render, fireEvent } from '@testing-library/react'; import { Icon, IconName, IconSize } from '../../component-library'; import { ActivityListItem } from './activity-list-item'; const TITLE = 'Hello World'; const SUBTITLE =

I am a list item

; const CLASSNAME = 'list-item-test'; const RIGHT_CONTENT =

Content rendered to the right

; const CHILDREN = ; const MID_CONTENT =

Content rendered in the middle

; const TOP_CONTENT =

Content rendered at the top

; describe('ActivityListItem', () => { const defaultProps = { className: CLASSNAME, title: TITLE, 'data-testid': 'test-id', subtitle: SUBTITLE, rightContent: RIGHT_CONTENT, midContent: MID_CONTENT, topContent: TOP_CONTENT, icon: , onClick: jest.fn(), }; it('should match snapshot with no props', () => { const { container } = render(); expect(container).toMatchSnapshot(); }); it('should match snapshot with props', () => { const { container } = render( {CHILDREN}, ); expect(container).toMatchSnapshot(); }); it('calls onClick when clicked', () => { const { getByTestId } = render(); fireEvent.click(getByTestId('test-id')); expect(defaultProps.onClick).toHaveBeenCalled(); }); });