May 2019
Intermediate to advanced
496 pages
10h 38m
English
We know that we have another bunch of tests within CustomerForm, and we have similar tests for AppointmentForm. How can we reuse what we've built in this one test across everything else? We can create a generalized spy function that can be used any time we want spy functionality.
Let's start by defining a function that can stand in for any single-argument function, such as the event handlers we would pass to the onSubmit form prop:
const singleArgumentSpy = () => { let receivedArgument; return { fn: arg => (receivedArgument ...Read now
Unlock full access