Other words.

How to know if a test sucks? You changed something that wouldn’t be observable to the user of your app/library, but the test broke and you had to fix the test. — Dan Abramov

Test behavior, not implementation details!

Don’t test the volatile things like component state (React/Angular/Vue).

Bad example

Every time when property “email” change, your test will fail!

Good example

We are testing that when we change the input, its value will be set correctly.

This will do the trick. We are not depending on the component state anymore.

More about this topic

How to properly test React Components 

Recommended book

Programming JavaScript Applications: Robust Web Architecture with Node, HTML5, and Modern JS Libraries