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 / TimezonePicker / TimezonePicker.spec.js
Size: Mime:
import React from 'react';
import { shallow } from 'enzyme';

import TimezonePicker from './TimezonePicker';
import CustomSelect from '../CustomSelect';
import './timezoneList';

/**
 * Returning a fake list just for the purpose of testing.
 */
jest.mock('./timezoneList', () => [
  {
    diff: 'GMT-11:00',
    id: 'Pacific/Midway',
    name: 'Midway',
    shortName: 'SST',
  },
  {
    diff: 'GMT-9:00',
    id: 'Pacific/Gambier',
    name: 'Gambier',
    shortName: 'GAMT',
  },
]);

describe('TimezonePicker', () => {
  it('renders a CustomSelect', () => {
    const component = shallow(<TimezonePicker />);
    expect(component.find(CustomSelect)).toHaveLength(1);
    expect(component).toMatchSnapshot();
  });

  it('contains the timezone options', () => {
    const component = shallow(<TimezonePicker />);
    expect(component.find(CustomSelect).props().options).toHaveLength(2);
  });
});