.vue
login(){
apiUser.login(this.phone, this.password).then((res) => {
const data = res.data
if (data.code === 200) {
this.$store.commit('login')
this.$store.commit('modifyUserId', data.profile.userId)
this.storage(data.profile.userId, data.profile.nickname, data.profile.avatarUrl)
alert('登录成功!')
this.close()
} else {
alert(res.data.msg)
}
})
}
.spec.js
it('输入错误的手机号或密码', () => {
vm.phone = '123123123'
vm.password = '12312'
vm.login()
expect()
})
例如这段代码, 在test中调用login()后,箭头函数里面的代码没有被覆盖掉,请问在单测中如何写呢??
求教大佬啊。。。。。。。。。。。。。。。。