Exercises
The following are some exercises for you to try out:
- Complete the message property tests on the
toBeRenderedWithProps
matcher. - Add the
toBeFirstRenderedWithProps
matcher and update your test suite to use this matcher. Since this matcher is very similar totoBeRenderedWithProps
, you can add it to the same module file that contains thetoBeRenderedWithProps
matcher. You can also try to factor out any shared code into its own function that both matchers can use. - Add a
toBeRendered
matcher that checks if a component was rendered without checking its props. - Complete the matchers you’ve written so that they throw an exception if the passed argument is not a Jest mock.
- Create a new component,
AppointmentFormLoader
, that calls theGET /availableTimeSlots
endpoint when mounted. It should render anAppointmentForm
component with itsappointments
prop set to the data returned from the server.