mercredi 4 mai 2016

Jest: How to unmock components listed in an index.js file?

Using Jest to unit test my react components.

I list my components under src/components/index.js so I can to do the following:

import { MyComponent } from 'components';

When using jest how do I call unmock on such a require path?

jest.unmock('components/MyComponent'); // ???

import { MyComponent } from 'components';

// ... tests below ...

The above does not work, although that is basically the desired outcome.

Aucun commentaire:

Enregistrer un commentaire