The third argument can be used to create virtual mocks – mocks of modules that don't exist anywhere in the system:
jest.mock( '../moduleName', () => { /* * Custom implementation of a module that doesn't exist in JS, * like a generated module or a native module in react-native. */ }, {virtual: true}, );
 
      withRouter(connect(...)(MyComponent))
// or
compose(
  withRouter,
  connect(...)
)(MyComponent)