Files
app-261004/skill/fullstack-task/references/testing.md
T
2026-10-08 11:09:37 +08:00

38 lines
581 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 测试规范
## 分层
- 单元测试:纯函数、工具、校验
- 集成测试:API、DB、服务
- 端到端:主链路
## 工具
- Vitest:单元 + 集成
- Playwright:端到端
- MSW:mock 网络
## 用例设计
每个功能至少覆盖:
- happy path
- 空值 / 缺字段
- 非法输入
- 权限不足
- 资源不存在
- 并发或重复提交
## 命名
- describe("createPost", () => {
- it("creates a post with valid input", ...)
- it("rejects empty title", ...)
- })
## CI
- push 触发 lint + typecheck + test
- 主分支保护
- 失败阻断合并