Jest: Vuex dispatch function doesn't get tracked

I want to track the amount of time axios.get has been called. As in this example, axios should have been called twice.

This is my Vuex module.

const state = { ... }
const getters = { ... }
const mutations = { ... }
const actions = {
  async method1 ({ commit, dispatch } = {}, data) {
    dispatch('method2', await axios.get(...))
  async method2 ({ state, commit } = {}, data) {
   commit('setState', await axios.get(...))

And this is my test I did


Jest runs through this and says:

Received number of calls: 1

I’ve spied on both methods:

actions = {
  method1: jest.spyOn(lookup.actions, 'method1'),
  method2: jest.spyOn(lookup.actions, 'method2')

And mocked this into a new Vuex.Store instance. I also have replaced the axios.get function with a jest.fn() mock implementation.

The thing is, that if I log both methods, both get invoked, but only one is getting tracked and this is method1. Why is that so?

Sorry, I’m stupid. Nothing vuex / vue / jest related. Just using two different axios interfaces for each request.