jest.spyOn does not work for an imported function.
There is an error - Expected mock function to have been called, but it was not called.
import testFn from 'test'
// test.js
// import foo from 'foo'
// export default () => foo('text')
import * as foo from 'foo'
// foo.js
// export default (value) => value
const spyFn = jest.spyOn(foo, 'default')
testFn()
expect(spyFn).toHaveBeenCalled()
I expect that the default function is mocked.