Skip to content

Commit 9745dc3

Browse files
committed
test: 增加测试
1 parent 2ae8e9d commit 9745dc3

File tree

3 files changed

+68
-52
lines changed

3 files changed

+68
-52
lines changed

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,12 @@
5656
"@release-it/conventional-changelog": "^5.0.0",
5757
"@types/lodash-es": "^4.17.6",
5858
"@types/markdown-it": "^12.2.3",
59-
"@types/node": "^17.0.43",
59+
"@types/node": "^18.0.0",
6060
"@types/prettier": "^2.6.3",
6161
"@typescript-eslint/eslint-plugin": "^5.28.0",
6262
"@typescript-eslint/parser": "^5.28.0",
6363
"@vitejs/plugin-vue": "^2.3.3",
64-
"@vitest/ui": "^0.15.0",
64+
"@vitest/ui": "^0.15.1",
6565
"@vue/test-utils": "2.0.1",
6666
"@vue3-oop/plugin-vue-jsx": "^1.4.0",
6767
"ant-design-vue": "^3.2.7",
@@ -72,9 +72,9 @@
7272
"eslint-plugin-prettier": "^4.0.0",
7373
"happy-dom": "^5.3.1",
7474
"injection-js": "^2.4.0",
75-
"lint-staged": "^13.0.1",
75+
"lint-staged": "^13.0.2",
7676
"lodash-es": "^4.17.21",
77-
"prettier": "^2.7.0",
77+
"prettier": "^2.7.1",
7878
"release-it": "^15.0.0",
7979
"rimraf": "^3.0.2",
8080
"sass": "^1.52.3",
@@ -84,7 +84,7 @@
8484
"vite-plugin-dts": "^1.2.0",
8585
"vite-tsconfig-paths": "^3.5.0",
8686
"vitepress": "1.0.0-alpha.2",
87-
"vitest": "^0.15.0",
87+
"vitest": "^0.15.1",
8888
"vue": "^3.2.37",
8989
"vue-router": "^4.0.16"
9090
},

pnpm-lock.yaml

Lines changed: 47 additions & 47 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/component.test.tsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,19 @@ test('带slots的组件', async () => {
6565
const wrapper = mount(Count, { slots })
6666
expect(wrapper.text()).toContain('aaa')
6767
})
68+
69+
test('init 组件初始化调用', async () => {
70+
class Count extends VueComponent {
71+
@Mut() count = 0
72+
73+
init() {
74+
this.count = 1
75+
}
76+
77+
render() {
78+
return <div>{this.count}</div>
79+
}
80+
}
81+
const wrapper = mount(Count)
82+
expect(wrapper.text()).toContain('1')
83+
})

0 commit comments

Comments
 (0)