I have the following code:
const [createPatient, { loading }] = useMutation(CREATE_PATIENT_MUTATION, {
onCompleted: (data) => {
const { patient } = data.createPatient;
close();
console.log(data);
notificationQueue.add(uuid(), {
type: "success",
icon: "Success",
title: `${userUtils.fullName(patient)} created`,
description: "Patient was successfully created.",
});
},
});
When it succeeds, data.createPatient.patient
populated during development. It works as expected.
However, in my tests it’s an empty object. I’ve verified the MockedProvider
is using a complete response with a patient
object, but it’s empty in the onComplete
method anyway.
I came across this thread, but it’s been archived so I haven’t been able to ask any questions: `onCompleted` does not receive mocked data from MockedProvider · Issue #3899 · apollographql/react-apollo · GitHub