Files
hms/docs/audits/v2/08-test-coverage-refresh.md
iven df1d85bfde docs: T40 UI 审计报告 + wiki 更新 + Docker 配置
- T40 UI 审计计划和结果文档(docs/qa/)
- wiki 更新:miniprogram 设计系统合规审计记录 + index 关键数字更新
- 审计 V2 完整报告(docs/audits/v2/)
- 讨论记录文档(docs/discussions/)
- 设计规格和实施计划(docs/superpowers/)
- 角色测试计划和结果(docs/qa/role-test-*)
- Docker 生产部署配置
2026-05-13 23:29:42 +08:00

58 lines
2.2 KiB
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.
# Phase 8: 测试覆盖率刷新
审计日期: 2026-05-04
## 1. Web 测试文件统计
`apps/web/src``*.test.*` 文件共 **59 个**,覆盖:
- API 测试: 17 个health api、auth、users、roles、orgs、dictionaries、config-modules、messages、workflow、auditLogs、pluginData、plugins
- Store 测试: 5 个auth、health、app、message、workbenchStore、plugin
- 页面测试: 22 个PatientList、AlertList、DoctorList、AppointmentList 等)
- 工具/钩子测试: 4 个useThemeMode、useDebouncedValue、exprEvaluator、renderWithProviders
- 常量测试: 1 个health.test.ts
## 2. 新增功能测试覆盖
| 模块 | 测试文件 | 状态 |
|------|---------|------|
| care_plan | **无** | **缺失** |
| shift | **无** | **缺失** |
| ble_gateway | **无** | **缺失** |
| action_inbox | dashboard.test.ts 中间接覆盖 | 部分覆盖 |
| family_proxy | **无** | **缺失** |
| oauth | OAuthClientList.test.tsx | OK |
| fhir | OAuthClientList.test.tsx同上OAuth 页面) | 部分覆盖 |
| dialysis | DialysisManageList.test.tsx | OK |
| AI 分析 | AiAnalysisList.test.tsx | OK |
**5/7 新增模块无专属测试文件**: care_plan、shift、ble_gateway、family_proxy、fhir 无独立测试。
## 3. MP 测试状态
`apps/miniprogram/__tests__/` 中仅 **4 个测试文件**,全部为 BLE 相关:
- BLEManager.test.ts
- DataBuffer.test.ts
- DataSyncScheduler.test.ts
- GenericBleAdapter.test.ts
**新增业务功能dialysis、consent、diagnosis、action-inbox、AI suggestion无任何测试文件。**
确认 MP 测试覆盖: 业务层 **0**,仅 BLE 基础设施层有测试。
## 4. 后端测试补充
`crates/erp-health/src/event.rs` 包含 **40+ 个单元测试**,覆盖:
- 事件类型常量校验(命名规范、唯一性、值匹配)
- 消费者前缀覆盖验证13 个前缀覆盖测试)
- Payload 契约测试10+ 个场景)
- EventBus 过滤订阅行为测试
- 消费者幂等 ID 唯一性
后端事件系统测试覆盖良好,但 **前端新增模块测试严重不足**
## 5. 建议
1. 优先为 care_plan、shift、ble_gateway、family_proxy 补充 API 层测试
2. MP 补充 dialysis/consent/diagnosis 服务层单元测试
3. 考虑为新增页面添加组件渲染测试