DEV Community

Discussion on: What I've Learned About Testing React Apps - Unit Tests

Collapse
 
gumballhead profile image
Andrew Kirkegaard • Edited

Though I do agree that react component tests should just test behavior, I would say that's not a unit test. Unit tests should test logic and have no dependencies. You should be testing logic directly and not through side effects of rendering a component.

Also, tests are a feedback tool. If they're brittle and break, that's a good thing -- you got some valuable feedback about the impact of the change you made to the system.