title: Testing Global Vue.prototype.$http method in Jest which uses axios in Vue
body: <p>I have a global prototype defined in my Vue project in main.js as follows</p>
  
  <pre><code>//main.js
  
  import axios from 'axios';
  import Vue from 'vue';
  
  Vue.prototype.$http=axios.create({
     baseURL: 'https://example.com/api/' 
  });
  </code></pre>
  
  <p>Various vue components directly call <code>this.$http.get</code> or <code>this.$http.post</code> for performing requests.
  How do I test these components in Jest, apparently using mock I can mocks I can do </p>
  
  <pre><code>jest.mock('axios')
  </code></pre>
  
  <p>but my project is huge and changing every instance of <code>this.$http</code> to axios is not feasible.</p>
  
  <p>How to achieve this using <code>jest.mock</code>?</p>
  
  <p>Also how to test if a single component is doing multiple API calls on different endpoints?</p>