title: Jest TypeError: is not a constructor in Jest.mock
body: <p>I am trying to write a unit test case using jest and need to mock the below pattern . I am getting TypeError: is not a constructor.</p>
  
  <p>Usecase :  My usecase is as mentioned below</p>
  
  <p>MyComponent.js :</p>
  
  <pre><code> import serviceRegistry from "external/serviceRegistry";
  
  
          serviceRegistry.getService("modulename", "servvice").then(
                service =&gt; {
                  let myServiceInstance = new service();
                  myServiceInstance.init(p,d) 
          })
  </code></pre>
  
  <p>Mycomponent.spec.js</p>
  
  <pre><code>jest.mock('external/serviceRegistry', () =&gt; {
        return {
          getService: jest.fn(() =&gt; Promise.resolve({
            service: jest.fn().mockImplementation((properties, data, contribs) =&gt; {
              return {
                init: jest.fn(),
                util: jest.fn(),
                aspect: jest.fn()
  
              };
            })
          }))
        };
      }, {virtual: true});
  </code></pre>