Skip to content

mock up $axios #105

Open
Open
@kyzia551

Description

@kyzia551

Hi!
I'm trying to test vuex actions like

  async addEmail ({commit}, email) {
    commit('ADD_EMAIL_START')
    try {
      const resp = await this.$axios.$post('/users/addEmail', qs.stringify({ email }))
      commit('ADD_EMAIL_SUCCESSFUL')
    } catch (e) {
      commit('ADD_EMAIL_FAILED', e)
    }
  }

How to mock up $axios this way?

Stack: jest + vue-test-utils
Thank you!

This feature request is available on Nuxt.js community (#c91)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions