dimanche 27 septembre 2020

Jest snapshot testing TypeError: Invalid attempt to destructure non-iterable instance

I have a component in my react codebase and i trying to create some snapshot tests for it, but unfortunately there is some weird error going on, jest implies that Im doing some destructuring on non-iterable instance and logs shows some thing that how ever much i tried to think about it, it would work perfectly, but i don't know what is wrong with this snippet of code shown in image below:

1

also please notice that i did a mock for formik in my component like below:

jest.mock('formik', () => ({
  useField: jest.fn(),
  useFormikContext: jest.fn(),
}));

and every other question related to the topic either is not for jest or answer is not working and not even accepted!

any help would be appritiated!

Aucun commentaire:

Enregistrer un commentaire