fix: 单测的一些注释和配置顺序更改
This commit is contained in:
@@ -2,12 +2,12 @@ module.exports = {
|
||||
roots: [
|
||||
'<rootDir>/test'
|
||||
],
|
||||
verbose: true,
|
||||
setupFilesAfterEnv: ['<rootDir>/test/init.js'],
|
||||
testMatch: [
|
||||
'<rootDir>/test/**/__tests__/**/*.{vue,js,jsx,ts,tsx}',
|
||||
'<rootDir>/test/**/*.{spec,test}.{vue,js,jsx,ts,tsx}'
|
||||
],
|
||||
setupFilesAfterEnv: ['<rootDir>/test/init.js'],
|
||||
verbose: true,
|
||||
testEnvironment: 'jsdom',
|
||||
transform: {
|
||||
'^.+\\.(vue)$': '<rootDir>/node_modules/vue-jest',
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/**
|
||||
* jest: https://jestjs.io/docs/getting-started
|
||||
* vue-jest: https://test-utils.vuejs.org/guide/
|
||||
* */
|
||||
|
||||
import Test from '../src/Test'
|
||||
import { mount } from '@vue/test-utils'
|
||||
import { getNameByEventType } from '@/utils/tools'
|
||||
@@ -24,7 +29,7 @@ describe('单元测试demo', () => {
|
||||
// 断言点击按钮后文本dom的内容是否是'2'
|
||||
expect(textNode.text()).toBe('2')
|
||||
|
||||
/* 更多断言类型:https://jestjs.io/zh-Hans/docs/expect */
|
||||
/* 更多断言类型:https://jestjs.io/docs/expect */
|
||||
})
|
||||
|
||||
test('Vue组件--直接获取vue实例中的data和method', async () => {
|
||||
|
||||
@@ -50,11 +50,11 @@ describe('NetworkOverviewLine.vue测试', () => {
|
||||
const textNode0 = await wrapper.get('[test-id="tabContent0"]')
|
||||
const textNode1 = await wrapper.get('[test-id="tabContent1"]')
|
||||
const textNode2 = await wrapper.get('[test-id="tabContent2"]')
|
||||
await new Promise(res => setTimeout(() => {
|
||||
await new Promise(resolve => setTimeout(() => {
|
||||
expect(textNode0.text()).toEqual('14.06Kpackets/s')
|
||||
expect(textNode1.text()).toEqual('4.24Kpackets/s')
|
||||
expect(textNode2.text()).toEqual('9.17Kpackets/s')
|
||||
res()
|
||||
resolve()
|
||||
}, 1000))
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user