【发布时间】:2018-08-27 11:11:31
【问题描述】:
Vue 单元测试错误:预期 [Function: proxy] 为假
Vue组件中的函数是:
data(){
return{
showcart:false
}
}
methods:{
closedialoguebox: function() {
return (this.showcart = false);
}
}
相应功能的单元测试用例是:
it('closedialoguebox函数点击home时应该关闭对话框', () => {
const Mockedshowcart = false
const someStub = sinon.stub(wrapper.vm,'closedialoguebox').returns(Mockedshowcart)
expect(someStub).to.be.false
}) }
我得到的错误是:
× closedialoguebox function should close the dialogue box when clicked on home
expected [Function: proxy] to be false
提前致谢
【问题讨论】:
标签: unit-testing vuejs2 chai karma-mocha