Repository URL to install this package:
|
Version:
4.3.1 ▾
|
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);
});
});