↧
Answer by slideshowp2 for Jest - Mock a function getting imported in a...
You can use jest.spyOn(object, methodName) method, here is a completed demo: idnex.tsx: import React, { Component } from 'react'; import { someHelper } from './utils'; class SomeComponent extends...
View ArticleJest - Mock a function getting imported in a component file you're testing
I have a class component that I want to test using jest. That component is using a function getting imported from a utils file. How do I mock that imported function from my main test file?
View Article