title: Vuex mock store undefined in Jest unit test
body: <p>I'm new to jest and am trying to write a unit test that relies on the value of a store property.</p>
  <p>I tried to create a new mock store in my test (I already have a mock store for a different test), but for some reason, I keep getting the error</p>
  <pre><code>TypeError: Cannot read property 'state' of undefined
  </code></pre>
  <p>My tests are:</p>
  <pre class="lang-js prettyprint-override"><code>import { shallowMount, createLocalVue,} from '@vue/test-utils';
  import userButtons from '@components/user-profile/UserButtons.vue';
  import Vuex from 'vuex';
  import { defaultValues, } from '@store/api/userButtons.js';
  
  const localVue = createLocalVue();
  localVue.use(Vuex);
  
  describe('UserButtons', () =&gt; {
      let actions; 
      let store;
      let storeIsAdded;
      
      beforeEach(() =&gt; {
      actions = {
          getUserInfo: jest.fn(),
      };
      store = new Vuex.Store({
          modules: {
          userButtons: {
              namespaced: true,
              actions,
              state: {
              userButton: defaultValues,
              },
              mutations: {
              setUserButton: jest.fn(),
              },
          },
          },
      });
      storeIsAdded = new Vuex.Store({
          state: {
          isItemAdded: true,
          },
      });
      });
      test('vuex called on create', () =&gt; {
      shallowMount(UserButtons, { store, localVue, propsData: { id: 3406304, }, });
      expect(actions.getUserInfo).toHaveBeenCalled();
      });
  
      test('renders correctly', () =&gt; {
      const wrapper = shallowMount(UserButtons, { store, localVue, propsData: { id: 3406304, }, });
      expect(wrapper.element).toMatchSnapshot();
      });
  
      test('indicates remove if isItemAdded is true', () =&gt; {
      const wrapper = shallowMount(UserButtons, { storeIsAdded, localVue, propsData: { id: 3406304, }, });
      expect(wrapper.find('.button-action.my-items').text()).toBe('- Remove from My Items');
      });
  });
  </code></pre>
  <p>The first two tests, which just use <code>defaultValues</code> for my store, pass.</p>
  <p>The last test, <code>'indicates remove if </code>isItemAdded<code>is true, is the one that fails, and is using the mock store,</code>storeIsAdded`.</p>
  <p>If anyone has any insight, it would be much appreciated!!!</p>
  <p>EDIT:</p>
  <p>Even if I modify my mock store to be more similar to the store that seems to be working, like this:</p>
  <pre class="lang-js prettyprint-override"><code>storeIsInList = new Vuex.Store({
      modules: {
      userButton: {
          namespaced: true,
          actions,
          state: {
          userButton: {
              isItemAdded: true,
          },
          },
      },
      },
  });
  </code></pre>
  <p>I get the same error.</p>