PickerOption.test.tsx 858 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. import React from 'react';
  2. import renderer from 'react-test-renderer';
  3. import PickerOption from './PickerOption';
  4. const model = {
  5. cx: jest.fn(),
  6. clearValue: jest.fn(),
  7. onSelect: jest.fn(),
  8. getStyles: jest.fn(),
  9. getValue: jest.fn(),
  10. hasValue: true,
  11. isMulti: false,
  12. options: [],
  13. selectOption: jest.fn(),
  14. selectProps: {},
  15. setValue: jest.fn(),
  16. isDisabled: false,
  17. isFocused: false,
  18. isSelected: false,
  19. innerRef: null,
  20. innerProps: null,
  21. label: 'Option label',
  22. type: null,
  23. children: 'Model title',
  24. data: {
  25. title: 'Model title',
  26. imgUrl: 'url/to/avatar',
  27. label: 'User picker label',
  28. },
  29. className: 'class-for-user-picker',
  30. };
  31. describe('PickerOption', () => {
  32. it('renders correctly', () => {
  33. const tree = renderer.create(<PickerOption {...model} />).toJSON();
  34. expect(tree).toMatchSnapshot();
  35. });
  36. });