GeorgeHop/react-native-country-codes-picker

Unit Testing with Jest to take a snapshop.

algarcia-vector opened this issue · 1 comments

Hello, I was trying to make a snapshop using Jest but it's throwing me this error:

Screen Shot 2022-12-20 at 1 26 54

this is my snapshop:

import React from 'react';
import Phone from '../../../components/storyBook/components/inputs/Phone';
import renderer from 'react-test-renderer';

test('renders correctly', () => {
  const tree = renderer
    .create(
      <Phone
        onCountryCodeChange={() => {}}
        inputValue={''}
        onChangeText={() => {}}
        inputIsDisabled={false}
        floatingLabelText={'Label'}
        inputIsInValid={false}
      />,
    )
    .toJSON();
  expect(tree).toMatchSnapshot();
});

and this is my react component:

        <View>
          <CountryPicker
            lang="es"
            show={show}
            onBackdropPress={() => setShow(false)}
            pickerButtonOnPress={item => {
              setCountryCode(item.flag + ' ' + item.dial_code);
              onCountryCodeChange?.(item.flag + ' ' + item.dial_code);
              setShow(false);
            }}
            inputPlaceholder={'Selecciona tu país'}
            searchMessage={'Lo sentimos, no pudimos encontrar tu país'}
          />
        </View>

any suggestions on how to fix this issue?
"react-native": "0.68.2",
"react-native-country-codes-picker": "^2.2.0",

Hello! Thank's for using our lib! About the issue I don't know what to say. Have you checked the code of this react-test-renderer? Also I see that this is an experimental thing. so there may be some issues moreover I don't see any usage with react-native components.