dev: Improve support for front end unit tests (#7163)

This commit is contained in:
miah
2026-05-31 10:41:52 -05:00
committed by GitHub
parent 7b0d1fde64
commit 364af97060
11 changed files with 719 additions and 8 deletions

30
.vscode/test-block.code-snippets vendored Normal file
View File

@@ -0,0 +1,30 @@
{
"Test Block": {
"prefix": "mtest",
"body": [
"import { mount } from \"@vue/test-utils\";",
"import { describe, expect, test, vi } from \"vitest\";",
"import { makeWrapper } from \"~/tests/utils\";",
"",
"const wrapper = () => makeWrapper(() => {",
" return ${1:composable}();",
"});",
"",
"describe(\"${TM_FILENAME_BASE/(.*)\\..+$/$1/}\", () => {",
" describe(\"${2:method}\", () => {",
" test(\"It does the thing\", () => {",
" const { ${2:method} } = wrapper();",
" const result = ${2:method}();",
" expect(result).toBe(EXPECTED);",
" });",
" });",
"});",
"",
],
"description": "Insert a test block",
"scope": "typescript",
"include": [
"**/*.test.{ts,tsx,vue}"
]
}
}