Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('* tab choose', () => {
const onSelect = jest.fn();
const component = render(
<img style="{style}/">}
title='Screen 1'
selected={false}/>
<img style="{style}/">}
title='Screen 2'
selected={true}/>
<img style="{style}/">}
title='Screen 3'
selected={false}/>
it('* should pass props to an icon component', () => {
const component = render(
,
);
expect(component.getByTestId('custom-test-id')).toBeTruthy();
});
it('* date changes', () => {
const expectedDate: Date = new Date(2019, CURRENT_MONTH, 5);
const application: RenderAPI = render();
fireEvent.press(application.getAllByText('5')[0]);
const { date } = application.getByType(Calendar).props;
expect(date.toString()).toBe(expectedDate.toString());
});
it('Checks Sample component passes correct text props', async () => {
const text = 'Hello, World!';
const component = render(
,
);
const textComponent = component.getByName('Text');
expect(textComponent.props.children).toEqual(text);
});
it('* select onPress have been called', () => {
const onSelectPress = jest.fn();
const onMultiSelectPress = jest.fn();
const application: RenderAPI = render(
,
);
fireEvent.press(application.getAllByType(Select)[0]);
fireEvent.press(application.getAllByType(Select)[1]);
expect(onSelectPress).toHaveBeenCalled();
expect(onMultiSelectPress).toHaveBeenCalled();
});
it('* modal panel render with props / children checking', () => {
const component: RenderAPI = render(
,
);
const { output } = shallow(component.getByType(ModalPanel));
expect(output).toMatchSnapshot();
});
it('* range re-selected properly 2', () => {
const expectedStartDate: Date = new Date(2019, CURRENT_MONTH, 8);
const application: RenderAPI = render();
fireEvent.press(application.getAllByText('11')[0]);
fireEvent.press(application.getAllByText('26')[0]);
fireEvent.press(application.getAllByText('8')[0]);
const { range } = application.getByType(RangeCalendar).props;
expect(range.startDate.toString()).toBe(expectedStartDate.toString());
expect(range.endDate).toBeNull();
});
it('* default appearance styled properly', async () => {
const StyleConsumer = styled(Test);
const component: RenderAPI = render(
,
);
const withStateProp: RenderAPI = render(
,
);
const styledComponent: ReactTestInstance = component.getByTestId(styleConsumerTestId);
const withAppearanceComponent: ReactTestInstance = withStateProp.getByTestId(styleConsumerTestId);
expect(styledComponent.props.themedStyle).toMatchSnapshot();
expect(withAppearanceComponent.props.themedStyle).toMatchSnapshot();
it('* group menu works properly', () => {
const expectedSelectedItem: MenuItemType = { title: 'Option 32' };
const application: RenderAPI = render(
,
);
fireEvent.press(application.getAllByText('Option 3')[0]);
const { selectedIndex: selectedIndex1 } = application.getByType(Menu).props;
expect(selectedIndex1).toBeNull();
fireEvent.press(application.getAllByText('Option 32')[0]);
const { selectedIndex: selectedIndex2 } = application.getByType(Menu).props;
expect(selectedIndex2).toBe(3);
});
const renderComponent = (props?: CheckBoxProps): RenderAPI => {
return render(
,
);
};