The Composition of a Test
Learn how to properly compose a Jest test.
We'll cover the following...
Now that we have an understanding of the Jest setup, we can learn how to write a test.
In layman’s terms
Simply put, a test does exactly one thing. A test tells us whether Y
is true if we’re given X
. X
can be an argument passed to a function, an API response, a state, or a sequence of user behaviors, while Y
can be a return value, the calling of a function, presence in the DOM, an error, etc.
Another ...