Our tests are currently tightly coupled to the implementation of our component’s element structure. A refactor to that structure wont break our application, but will definitely break our tests because we’re testing implementation details. Let’s use DOM Testing Library to create a custom render function that will give us some helpful utilities for searching for elements in the DOM in the same way a user would.


Use DOM Testing Library to Write More Maintainable React Tests