How to use the react-native-testing-library.render function in react-native-testing-library

To help you get started, we’ve selected a few react-native-testing-library examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github akveo / react-native-ui-kitten / src / framework / ui / tabNavigator / bottomTabNavigator.spec.tsx View on Github external
it('* tab choose', () => {
    const onSelect = jest.fn();
    const component = render(
      
         <img style="{style}/">}
          title='Screen 1'
          selected={false}/&gt;
         <img style="{style}/">}
          title='Screen 2'
          selected={true}/&gt;
         <img style="{style}/">}
          title='Screen 3'
          selected={false}/&gt;
github akveo / react-native-ui-kitten / src / components / ui / icon / icon.spec.tsx View on Github external
it('* should pass props to an icon component', () =&gt; {
    const component = render(
      ,
    );

    expect(component.getByTestId('custom-test-id')).toBeTruthy();
  });
github akveo / react-native-ui-kitten / src / components / ui / calendar / calendar.spec.tsx View on Github external
it('* date changes', () =&gt; {
    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());
  });
github akveo / react-native-ui-kitten / src / framework / ui / sample / sample.component.spec.tsx View on Github external
it('Checks Sample component passes correct text props', async () =&gt; {
  const text = 'Hello, World!';
  const component = render(
    ,
  );
  const textComponent = component.getByName('Text');
  expect(textComponent.props.children).toEqual(text);
});
github akveo / react-native-ui-kitten / src / components / ui / select / select.spec.tsx View on Github external
it('* select onPress have been called', () =&gt; {
    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();
  });
github akveo / react-native-ui-kitten / src / components / theme / modal / modalPanel.spec.tsx View on Github external
it('* modal panel render with props / children checking', () =&gt; {
    const component: RenderAPI = render(
      
        
      ,
    );

    const { output } = shallow(component.getByType(ModalPanel));

    expect(output).toMatchSnapshot();
  });
github akveo / react-native-ui-kitten / src / components / ui / calendar / rangeCalendar.spec.tsx View on Github external
it('* range re-selected properly 2', () =&gt; {
    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();
  });
github akveo / react-native-ui-kitten / src / components / theme / style / style.spec.tsx View on Github external
it('* default appearance styled properly', async () =&gt; {
    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();
github akveo / react-native-ui-kitten / src / components / ui / menu / menu.spec.tsx View on Github external
it('* group menu works properly', () =&gt; {
    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);
  });
github akveo / react-native-ui-kitten / src / components / ui / checkbox / checkbox.spec.tsx View on Github external
const renderComponent = (props?: CheckBoxProps): RenderAPI =&gt; {
  return render(
    ,
  );
};

react-native-testing-library

Simple React Native testing utilities helping you write better tests with less effort

MIT
Latest version published 4 years ago

Package Health Score

65 / 100
Full package analysis