import React from 'react';
import renderer from 'react-test-renderer';
import { render, fireEvent } from '@testing-library/react';
import { ReactionIcon, ReactionIconProps } from './ReactionIcon';
import { ThumbsUpIcon } from './Icons';
const testLabels: ReactionIconProps = {
labelSingle: 'thumb',
labelPlural: 'thumbs',
};
describe('ReactionIcon', () => {
it('renders with default props', () => {
const tree = renderer.create().toJSON();
expect(tree).toMatchInlineSnapshot(`
`);
});
it('renders with icon as JSX.Element', () => {
const tree = renderer.create(} />).toJSON();
expect(tree).toMatchInlineSnapshot(`
`);
});
it('renders with icon as string (URL)', () => {
const tree = renderer
.create()
.toJSON();
expect(tree).toMatchInlineSnapshot(`
`);
});
it('renders with specified labels (singular)', () => {
const tree = renderer.create().toJSON();
expect(tree).toMatchInlineSnapshot(`
`);
});
it('renders with specified labels (plural)', () => {
const tree = renderer.create().toJSON();
expect(tree).toMatchInlineSnapshot(`
`);
});
it('renders with labels unspecified (singular)', () => {
const tree = renderer.create().toJSON();
expect(tree).toMatchInlineSnapshot(`
`);
});
it('renders with labels unspecified (plural)', () => {
const tree = renderer.create().toJSON();
expect(tree).toMatchInlineSnapshot(`
`);
});
it('checks if onPress callback has been called', () => {
const onClick = jest.fn();
const { getByRole } = render();
fireEvent.click(getByRole('button'));
expect(onClick).toHaveBeenCalledTimes(1);
});
});