0

i am learning jest and react-native-testing. I have a profile file like this:

...
const Profile = () => {
  const userInfo = useSelector(state => state.user);

  if(userInfo.isLogged) {
    return (
        <LoggedUI />
    )
  } else {
    return (
        <RegisterUI />
    )
  }
};

...

How can I test the render loggedui when state logged is true ?

  it('Should Render only the LoggedUI', () => {
    if(reduxState.isLogged === 1) .... (only exp.)
  });

  it('Should Render only the RegisterUI', () => {
    ...
  });


universe11
  • 703
  • 1
  • 11
  • 35

1 Answers1

0

You can wrap your component with an store provider -> Guide

Michael Bahl
  • 2,941
  • 1
  • 13
  • 16