lundi 5 novembre 2018

React Native - How do I specify state in tests?

I am currently working on a React Native component that uses local state to control some UI elements, ie, some elements are only rendered if some values in state are set to true. These values change depending on clicks within the component.

Is there a way for me to specify initial state when testing using react's TestRenderer? If not, how could I go around to testing this? I'd like to be able to render the component for certain states and test over it. Any helpful input is very much appreciated.

I can provide more detail if necessary.

Thanks in advance.

Aucun commentaire:

Enregistrer un commentaire