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调用。使用茉莉花进行测试时如何监视?