how to mock a child component component with forwardref in jest?

Viewed 213

i am new with jest and some how i am having hard time integrating test in a component with a child component:

const ComponentToTest = () =>
  <Formik
    {...{
      initialValues: createBeneficiaryInitialValues,
      onSubmit,
      validationSchema: addPayoutAccountValidationSchema,
    }}>
    <CreateBeneficiaryForm />
  </Formik>

but when i do this:

  it('it sends create Beneficiary mutation', () => {
    render(
      <RelayProvider {...{ environment }}>
        <ComponentToTest />
      </RelayProvider>
    );

i get this error when i run jest:

The above error occurred in the component: in ForwardRef (created by CreateBeneficiaryForm)

CreateBeneficiaryForm is from MyComponentToTest, why is it throwing error in jest?

0 Answers
Related