In the past few Media Library posts we haven't spent a lot of time thinking about testing. In this post we will catch up on any missing tests and fix at least one broken test.
3 posts tagged with "Jest"
View All Tags12. Media Library - Testing
Back in Part 7 we blew away our initial testing strategy and decided to move forward with react-testing-library (and jest-dom). In part 10 we wrote tests to confirm our auth library works as expected where we leveraged Jest directly as we were not testing any parts of React. In this post we will start to create tests for the React components we built in the previous post where we created the login, register and forgot password pages in our application.
4. Media Library - Testing - Jest and Enzyme
IMPORTANT!
I am going to replace the testing framework outlined in this post in a subsequent post (7. Media Library). The information outlined here is still relevant. The part that gets replaced is Enzyme (and its dependencies). You may want to skip the Walk Through, or if you prefer you can follow the Walk Through and we will eventually uninstall the Enzyme bits. The reason for this change is explained in subsequent posts.
Intro
I am going to assume we all agree on the merits of testing. My goal is 100% automated test coverage with any project. We will probably take a few shortcuts in this project and not test everything (or, at least not test everything as deeply as we may want). In keeping with our "move quickly" philosophy the tests will probably remain light until something indicates further investment in testing is warranted. For example, if a bug is reported, I will often fix the bug and try to write a test that would have uncovered the bug.