|
|
@@ -100,10 +100,16 @@ Draft
|
|
|
- **覆盖率要求**: 单元测试 ≥ 80%,集成测试 ≥ 60% [Source: architecture/testing-strategy.md#各层覆盖率要求]
|
|
|
|
|
|
#### 测试模式
|
|
|
-- **单元测试**: 测试 PaymentService 独立功能 [Source: architecture/testing-strategy.md#单元测试]
|
|
|
- **集成测试**: 测试支付路由与认证集成 [Source: architecture/testing-strategy.md#集成测试]
|
|
|
- **测试工具**: 使用 shared-test-util 基础设施 [Source: architecture/testing-strategy.md#包测试架构]
|
|
|
|
|
|
+#### 测试套件用法(参考 auth-module 模式)
|
|
|
+- **测试框架**: Vitest + Hono Testing Client [Source: packages/auth-module/tests/integration/phone-decrypt.integration.test.ts:1-2]
|
|
|
+- **数据库钩子**: 使用 `setupIntegrationDatabaseHooksWithEntities` [Source: packages/auth-module/tests/integration/phone-decrypt.integration.test.ts:31]
|
|
|
+- **测试客户端**: 使用 `testClient` 创建路由测试客户端 [Source: packages/auth-module/tests/integration/phone-decrypt.integration.test.ts:41]
|
|
|
+- **数据源获取**: 使用 `IntegrationTestDatabase.getDataSource()` [Source: packages/auth-module/tests/integration/phone-decrypt.integration.test.ts:44]
|
|
|
+- **Mock策略**: 对微信支付SDK进行适当的mock,避免真实API调用
|
|
|
+
|
|
|
#### 关键测试场景
|
|
|
- 支付创建参数验证
|
|
|
- 微信支付 SDK 集成测试
|
|
|
@@ -120,6 +126,7 @@ Draft
|
|
|
|
|
|
| Date | Version | Description | Author |
|
|
|
|------|---------|-------------|---------|
|
|
|
+| 2025-11-11 | 1.2 | 添加测试套件详细用法说明,参考auth-module模式 | Bob (Scrum Master) |
|
|
|
| 2025-11-11 | 1.1 | 添加现有测试文件迁移任务,优化测试策略 | Bob (Scrum Master) |
|
|
|
| 2025-11-11 | 1.0 | 创建小程序支付模块故事文档 | Bob (Scrum Master) |
|
|
|
|