DEV Community

Discussion on: Testing Forms in React using Enzyme and Jest

Collapse
 
hkrotsik profile image
Hleb Krotsik

Testing component by spying on useState or any internal methods can be considered as anti-pattern because all those tests rely on implementation details. It leads to massive tests rewriting in case of code refactoring
The better solution is to test component as a black box.
All benefits of this approach are described here

Collapse
 
vtechjm profile image
Kirk-Patrick Brown

Good article but I agree.