我正试图在柏树中存根。我有一个返回真或假的计算。我只想让它返回true。
computed: {
isAdmin() {
return this.$store.state.User.isRegistered &&
this.$store.state.User.isAdmin
}
}
有一篇关于使用vuex store的好文章
https://www.cypress.io/blog/2017/11/28/testing-vue-web-application-with-vuex-data-store-and-rest-backend/
但是我甚至不想碰商店。这可能吗?
还没有测试过,但是应该是这样的:
cy.stub(YourComponent.computed, 'isAdmin').callsFake(() => { return true })