Oftentimes I have functions that are imported into a React component that I want to test using jest/enzyme.
Normally, I can access a function defined in a component through wrapper.instance().functionName and then test if the function has been called. Similarly, I can pass a mock function in as props when mounting a component in a test, and then checking to see if that component has been called. However, I have no methods of testing functions that are imported into components (not defined internally or as props).
Is there a way to use jest/enzyme to define a global mock function that will be used in a component test that will override the implementation of function of the same name that has been imported into the component I'm testing?