我有问题 . 当我挂载组件Jest没有等待解决promises.fetch API没有在生命周期mount中执行 . 我已经尝试了flushPromises但没有工作 . 我已经尝试了mocha但同样的问题 .

describe('HelloWorld.vue', () => {
  it('should render correct contents', async () => {
    try {
      const wrapper = mount(HelloWorld, {
        store,
        localVue,

      })    

      await wrapper.vm.$nextTick()      
     await  flushPromise()

       expect(wrapper.contains('.hellonew')).toEqual(true)

    } catch (error) {
      console.log(error)
    }
  })
  afterEach(() => {
    fetchMock.restore()
  })
})

我的组件包含生命周期,它从API获取数据并存储它

import { mapGetters, mapActions } from "vuex";
export default {
  name: "HelloWorld",
  data() {
    return {
      msg: "Welcome to Your Vue.js App",
      loading: false
    };
  },
  methods: {
    ...mapActions(["setData"])
  },
  mounted() {

    this.setData();
  },
  computed:{
    ...mapGetters(['getData']),
    gg(){
      if(this.getData){
          console.log('99999')
      }
    }
  }
};