How to use the react-native-testing-library.shallow 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 / components / ui / radio / radio.spec.tsx View on Github external
it('checked disabled', () => {
    const component: RenderAPI = renderComponent({
      checked: true,
      disabled: true,
    });
    const { output } = shallow(component.getByType(Radio));

    expect(output).toMatchSnapshot();
  });
github akveo / react-native-ui-kitten / src / framework / theme / component / modal / modalPanel.spec.tsx View on Github external
it('* modal panel renders properly', () => {
    const component: RenderAPI = render(
      ,
    );

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

    expect(output).toMatchSnapshot();
  });
github akveo / react-native-ui-kitten / src / components / ui / checkbox / checkbox.spec.tsx View on Github external
it('* active', async () => {
    const component: RenderAPI = renderComponent();

    fireEvent(component.getByType(TouchableOpacity), 'pressIn');

    const active: ReactTestInstance = await waitForElement(() => {
      return component.getByType(CheckBox);
    });
    const { output: activeOutput } = shallow(active);

    fireEvent(component.getByType(TouchableOpacity), 'pressOut');

    const inactive: ReactTestInstance = await waitForElement(() => {
      return component.getByType(CheckBox);
    });
    const { output: inactiveOutput } = shallow(inactive);

    expect(activeOutput).toMatchSnapshot();
    expect(inactiveOutput).toMatchSnapshot('default');
  });
github akveo / react-native-ui-kitten / src / components / ui / checkbox / checkbox.spec.tsx View on Github external
it('* default', () => {
    const component: RenderAPI = renderComponent();
    const { output } = shallow(component.getByType(CheckBox));

    expect(output).toMatchSnapshot();
  });
github akveo / react-native-ui-kitten / src / components / ui / checkbox / checkbox.spec.tsx View on Github external
it('* active', async () => {
    const component: RenderAPI = renderComponent();

    fireEvent(component.getByType(TouchableOpacity), 'pressIn');

    const active: ReactTestInstance = await waitForElement(() => {
      return component.getByType(CheckBox);
    });
    const { output: activeOutput } = shallow(active);

    fireEvent(component.getByType(TouchableOpacity), 'pressOut');

    const inactive: ReactTestInstance = await waitForElement(() => {
      return component.getByType(CheckBox);
    });
    const { output: inactiveOutput } = shallow(inactive);

    expect(activeOutput).toMatchSnapshot();
    expect(inactiveOutput).toMatchSnapshot('default');
  });
github akveo / react-native-ui-kitten / src / components / ui / list / list.spec.tsx View on Github external
it('* description', () => {
    const item = () => {
      return (
        
      );
    };

    const component: RenderAPI = render(
      ,
    );

    const items: ReactTestInstance[] = component.getAllByType(ListItem);
    const { output } = shallow(items[0]);

    expect(output).toMatchSnapshot();
  });
github akveo / react-native-ui-kitten / src / components / ui / layout / layout.spec.tsx View on Github external
it('default', () => {
    const component: RenderAPI = renderComponent();

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

    expect(output).toMatchSnapshot();
  });
github akveo / react-native-ui-kitten / src / components / theme / modal / modalPanel.spec.tsx View on Github external
it('* modal panel renders properly', () => {
    const component: RenderAPI = render(
      ,
    );

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

    expect(output).toMatchSnapshot();
  });
github akveo / react-native-ui-kitten / src / components / ui / avatar / avatar.spec.tsx View on Github external
it('* default', () => {
      const component: RenderAPI = renderComponent({
        source: iconSource,
      });

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

      expect(output).toMatchSnapshot();
    });
github akveo / react-native-ui-kitten / src / components / ui / input / input.spec.tsx View on Github external
<img style="{style}">
        );
      };
      const label: string = 'Label';
      const caption: string = 'Caption Text';

      const component: RenderAPI = renderComponent({
        label,
        caption,
        captionIcon,
      });

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

      expect(output).toMatchSnapshot();
    });

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

67 / 100
Full package analysis