// @flow
import React from 'react';
import { renderSnapshot } from '../../../../../utils/tests';

import type { SegmentedControlItemProps } from './segmented-control-item.proptypes';
import { SegmentedControlItem as Item } from './index';

const DEFAULT_CONTEXT = {
  selectedValue: 'another value',
  onItemClick: jest.fn(),
};

const DEFAULT_PROPS: SegmentedControlItemProps = {
  value: 'value',
  children: '',
};

describe('SegmentedControlItem', () => {
  describe('snapshot', () => {
    it('matches the previous snapshot', () => {
      const segmentedControlItem = renderSnapshot(
        <Item
          {...DEFAULT_PROPS}
          selectedValue={DEFAULT_CONTEXT.selectedValue}
          onItemClick={DEFAULT_CONTEXT.onItemClick}
        >
          Item
        </Item>,
      );
      expect(segmentedControlItem).toMatchSnapshot();
    });
  });
});
