mercredi 1 août 2018

Basic render test for react loadable components

I have a component that I'm dynamically loading

const Summary = loadable({ 
   loader: () => import( /* webpackChunkName: "summary" */ 'app/components/summary')
   resolveModule: module => module.default,
});

Problem: My module wasn't resolving correctly and hence the component didn't render on the screen.

Test: Component should render

While testing with jest, I'm getting either a timeout ( when using done ) or my component isn't loading in the first tick which causes the test case to fail.

Aucun commentaire:

Enregistrer un commentaire