Mock Es6 classes using Jest
Update: All this info and more has now been added to the Jest docs in a new guide, “ES6 Class Mocks.” Full disclosure: I wrote it. 🙂 The key to mocking ES6 classes is knowing that an ES6 class is a function. Therefore, the mock must also be a function. Call jest.mock(‘./mocked-class.js’);, and also import … Read more