茉莉花spyon在挂接钩vue.js上导入的方法

testComponent.vue

<script lang="ts">
import 'testMethod' from 'testService';
export default class testComponent extends Vue {
  mounted(){
    testMethod();
  }
}
</script>

testComponent.spec.vue

describe('test component',() => {
  it('should mount correctly',() => {
    const wrapper = shallowMount(testComponent);
  });
});

我要监视testMethod,因为它正在进行api调用。使用茉莉花进行测试时如何监视?

liufei0225 回答:茉莉花spyon在挂接钩vue.js上导入的方法

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/2980652.html

大家都在问