title: Testing component - Error in mounted hook: "TypeError: Cannot read property 'dispatch' of undefined"
body: <p>I am trying to write a simple test for my vue component. Since the vue component makes an async call on mount and updates the vuex store, <code>dispatch</code> is called during mount, which breaks my existing unit tests. Any idea how to overcome this? Since I am mocking table data, I don't need the mounted() function to be called when running the tests. </p>
  
  <p>MyTable.spec.js</p>
  
  <pre><code>     const wrapper = shallowMount(MyTable, {
          propsData: {
              tableData: [
                  {
                      "product_id":10826345236,
                      "name":"T-Shirt"
                  }
              ],
              columns: ['product_id', 'name'],
              headings: ['Product ID', 'Name'],
              actionType: 'loadProducts'
          }
      });
      ...
  </code></pre>
  
  <p>MyTable.vue</p>
  
  <pre><code>    ...
      data() {
          return {
              options: {
                  ...
              }
          };
      },
      methods: {
          getHeadings() {
              let headings = {};
              this.columns.map((key, i) =&gt; headings[key] = this.headings[i]);
              return headings;
          },
          setColumnClasses() {
              let classes = {};
              this.columns.map((key) =&gt; classes[key] = key);
              return classes;
          },
          loadRecords(actionType) {
              this.$store.dispatch(actionType);
          }
      },
      props: {
          tableData: {
              type: Array,
              required: true
          },
          columns: {
              type: Array,
              required: true
          },
          actionType: {
              type: String,
              required: true
          },
          headings: {
              type: Array,
              required: true
          },
          ...
      },
      mounted() {
          this.loadRecords(this.actionType);
      }
  </code></pre>