Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
@doodle/components / controls / CustomSelect / CustomSelect.spec.js
Size: Mime:
import React from 'react';
import { shallow } from 'enzyme';
import CustomSelect from './CustomSelect';

describe('CustomSelect', () => {
  let component;
  let props;

  beforeEach(() => {
    props = {
      options: [
        {
          text: 'Description',
          value: 'descr',
        },
      ],
      name: 'test name',
      errorMessage: 'Not selected',
      valid: true,
      label: 'Select country',
    };
    component = shallow(<CustomSelect {...props} />);
  });

  it('should match a snapshot', () => {
    expect(component.getElement()).toMatchSnapshot();
  });

  it('should match a snapshot when its not valid', () => {
    component.setProps({ valid: false });
    expect(component.getElement()).toMatchSnapshot();
  });

  it('should match a snapshot when there is a note', () => {
    component.setProps({ note: 'Some note' });
    expect(component.getElement()).toMatchSnapshot();
  });
});