Testing Post Components
Follow step-by-step instructions to write test cases for the post components.
Now that we’ve had a solid introduction to testing in React, let’s continue with writing tests for the Post
components.
The functionalities to create, read, update, and delete posts are core features of the Postagram application, so it’s important to make sure that they work as expected. Let’s start with a simple test for the Post
component.
Mocking the localStorage
object
Before writing a test for the Post
component, it’s important to understand how the Post components work. Basically, it takes a prop called post
and makes a call to localStorage
to retrieve information about the user. Unfortunately, ...
Get hands-on with 1400+ tech skills courses.