May 2019
Intermediate to advanced
496 pages
10h 38m
English
There is one aspect of the AppointmentForm change that is worth drawing attention to.
The AppointmentFormLoader test suite (in test/AppointmentFormLoader.test.js) has changed how it stubs out AppointmentForm. Previously, we used jest.spyOn to stub it out:
jest .spyOn(AppointmentFormExports, 'AppointmentForm') .mockReturnValue(null);
Unfortunately, spyOn does not work with functions that are wrapped with the connect function. connect doesn't return a function itself but instead, an object that React understands.
If that sounds a bit cryptic, think of it like this. If you were to run console.log(AppointmentForm) prior to changing it to use connect, you'd see this in your console output:
[Function: ...
Read now
Unlock full access