title: jest assert a function have been called twice and both times with particular argument
body: <p>I am testing a Vue component that dispatches an action(<code>functionx</code>) on mount. The same action(<code>functionx</code>) is dispatched when a particular <code>refresh</code> button is clicked. I am testing the behavior of that refresh button - that is the vuex dispatch action is called with argument 'functionx'. Here is my test:</p>
  <pre class="lang-js prettyprint-override"><code>   it('makes an api call to server when refresh button is clicked', () =&gt; {
        store.dispatch = jest.fn();
  
        const wrapper = mount(Categories, {
           sync: false,
           store,
           localVue
        });
  
        const refreshButton = wrapper.find('span.fa-sync');
        refreshButton.trigger('click');
  
        expect(store.dispatch).toHaveBeenCalledWith('categoryStore/fetchCategories');
     })
  });
  </code></pre>
  <p>which passes. Now since the same action is dispatched initially when the component is mounted. So in total dispatch is called twice. I know I can use <code>.toHaveBeenNthCalledWith(nthCall, arg1, arg2, ....)</code> to check that dispatch was called both times with same argument, but for that I will have to write two expect statements, like below:</p>
  <pre class="lang-js prettyprint-override"><code>expect(store.dispatch).toHaveBeenNthCalledWith(1, 'categoryStore/fetchCategories');
  expect(store.dispatch).toHaveBeenNthCalledWith(2, 'categoryStore/fetchCategories');
  </code></pre>
  <p>Is there any way I can achieve the above thing in one statement? Any matcher function or any property on the <code>expect</code> object that can be used?</p>