cascnauipackages
Version:
Repo for Common Components for CASCNA
34 lines (27 loc) • 724 B
JavaScript
import React from 'react';
import { shallow } from 'enzyme';
import {
View,
} from 'react-native';
import SegmentTabControl from '..';
describe('should render correctly', () => {
let wrapper;
beforeEach(() => {
wrapper = shallow(
<SegmentTabControl
tabs={['Priced', 'NBE', 'Unpriced Basis']}
selectTab={() => {}}
/>,
);
});
it('should match snapshot', () => {
expect(wrapper).toMatchSnapshot();
});
it('should render 3 view components', () => {
expect(wrapper.find(View).length).toBe(3);
});
it('should set state on tab change', () => {
wrapper.instance().tabSelectedAtIndex(1);
expect(wrapper.instance().state.selectedIndex).toEqual(1);
});
});