Making use of callback values
In this section, we’ll introduce a new state variable, customer
, that will be set when CustomerForm
receives the onSave
callback. After that, we’ll do the final transition in our workflow, from addAppointment
back to dayView
.
Follow these steps:
- This time, we’ll check that the new customer ID is passed to
AppointmentFormLoader
. Remember in the previous section how we gavesaveCustomer
a customer parameter? We’ll make use of that in this test:it("passes the customer to the AppointmentForm", async () => {   const customer = { id: 123 };   render(<App />);   beginAddingCustomerAndAppointment();   saveCustomer(customer);   expect(AppointmentFormLoader).toBeRenderedWithProps(     expect.objectContaining({       original: expect.objectContaining({         customer...