mercredi 21 août 2019

How to perform snapshot testing on FullCalendar Component in React

I am able to snapshot test other components which are connected to redux by using a mock store and passing jest functions as props.

But while testing my components which contain FullCalendar in render, I receive

I have already tried passing all possible props with mockstore and context. Also, I have implemented a basic test to just check if the component is rendered correctly or not which passes.

 Error: Uncaught [TypeError: Cannot read property 'addEventListener' of null]
at reportException (/Documents/frontend-2g/node_modules/jsdom/lib/jsdom/living/helpers/runtime-script-errors.js:66:24)
at invokeEventListeners (/Documents/frontend-2g/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:209:2g/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:119:9)
at HTMLUnknownElementImpl.dispatchEvent (/Documents/frontend-2g/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:82:17)
at HTMLUnknownElementImpl.dispatchEvent (/Documents/frontend-2g/node_modules/jsdom/lib/jsdom/living/nodes/HTMLElement-impl.js:30:27)
at HTMLUnknownElement.dispatchEvent (/Documents/frontend-2g/node_modules/jsdom/lib/jsdom/living/generated/EventTarget.js:157:21)
at Object.invokeGuardedCallbackDev (/Documents/frontend-2g/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:2427:16)

  The above error occurred in the <FullCalendar> component:
          in FullCalendar (at Calendar.jsx:37)

Aucun commentaire:

Enregistrer un commentaire