如果我的SFC是否依赖于main.js中包含的某些方法,我将如何进行测试
main.js
Vue.mixin(
methods: {
axiosAjax,
}
}
)
/* eslint-disable no-new */
new Vue(
{
el: "#app",
router,
store,
components: { App },
template: "<App/>",
}
)
找不到axiosAjax
我要如何测试
import { mount } from "@vue/test-utils"
import AccountMap from "@/components/Account/AccountMap/AccountMap"
describe("AccountMap.vue", () =>
{
it(
"does something",
() =>
{
delete AccountMap.mounted
let mounted = mount(AccountMap)
console.log(mounted.axiosAjax)
expect(mounted.contains("div")).toBe(true)
}
)
})
没有axiosAjax
,但是在网站上运行应用程序时可以访问它。