Choose another term
我是 Vue JS 的 Jest 测试套件的新手,并将其集成到我的 Nuxt JS 应用程序中。我已经设置了一些基本测试来检查组件是否是 Vue 实例并且这些测试是否成功通过。
我现在尝试在我的页面上查找一个元素并检查它是否存在,以及其中可能存在的内容。
这是我的结构
pages/application/begin.vue
组件/表单/步骤/贷款/LoanTerm.vue
Choose another termContinue
我设置的测试提供了以下内容:
import { mount } from '@vue/test-utils'
import LoanTerm from '@/components/Form/Steps/Loan/LoanTerm'
describe('LoanTerm', () => {
test('is a Vue instance', () => {
const wrapper = mount(LoanTerm)
expect(wrapper.vm).toBeTruthy()
})
test('terms are available for selection', async () => {
const wrapper = mount(LoanTerm)
const terms = await wrapper.find('.jest__datasets-terms')
expect(terms.exists()).toBe(true)
})
})
我运行此测试得到的结果是我的“条款可供选择” “测试失败,因为它收到错误。
我也尝试过使用 findAll,它什么也不返回
我错过了什么?
Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号