TypeError: Cannot destructure property 'values' of 'formik' as it is undefined

I am having typeError in my jest test

I have parent component

<Formik>
  <Form>
   <TextField />
  </Form>
</Formik>

And child component

// TextField.jsx

const TextField = () => {
  const {values} =  useFormikContext();

// do what you want with formik
}

In my TextField test file

I have mocked formik as shown

//TextField.spec.js
jest.mock(‘formik’)

beforeEach(()=>{useFormikContext.mockReturnValue({values:{}})

I get typeerror

TypeError: Cannot destructure property 'values' of 'formik' as it is undefined.

in test file but code works ok, can anyone help me?

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum