|
|
@@ -52,9 +52,9 @@ Ready for Development
|
|
|
- **其他组件**: DataTablePagination [路径: src/client/admin/components/DataTablePagination.tsx], AuthProvider [路径: src/client/admin/hooks/AuthProvider.tsx]
|
|
|
|
|
|
### 测试策略
|
|
|
-**集成测试重点** (`src/client/admin/__integration_tests__/`):
|
|
|
+**集成测试重点** (`src/client/__integration_tests__/admin/`):
|
|
|
- 使用 `hono/testing` 的 `testClient` 进行类型安全的API集成测试
|
|
|
-- 组件与真实API集成测试 [API端点: /api/users/*, /api/auth/login]
|
|
|
+- 组件与真实API集成测试 [API端点: /api/v1/users/*, /api/v1/auth/login]
|
|
|
- 用户界面行为和数据流测试
|
|
|
- 表单验证和错误处理测试
|
|
|
- 路由和导航集成测试
|
|
|
@@ -128,7 +128,7 @@ describe('UsersPage 集成测试', () => {
|
|
|
});
|
|
|
```
|
|
|
- **测试位置**:
|
|
|
- - 集成测试: `src/client/admin/__integration_tests__/*.test.tsx` (使用 `.test.tsx` 后缀以匹配现有配置)
|
|
|
+ - 集成测试: `src/client/__integration_tests__/admin/*.test.tsx` (使用 `.test.tsx` 后缀以匹配现有配置)
|
|
|
- E2E测试: `tests/e2e/specs/admin/*.spec.ts`
|
|
|
- 现有单元测试: `src/client/admin/**/__tests__/*.test.tsx` (保持不变)
|
|
|
- **测试模式**: 集成测试推荐使用 `hono/testing` 的 `testClient` 以获得更好的类型安全和维护性
|
|
|
@@ -177,10 +177,15 @@ npm run test:e2e
|
|
|
npm run test
|
|
|
|
|
|
# 运行特定组件测试文件
|
|
|
-npm run test:components -- src/client/admin/__integration_tests__/dashboard.test.tsx
|
|
|
+npm run test:components -- src/client/__integration_tests__/admin/dashboard.test.tsx
|
|
|
+
|
|
|
+# 运行特定组件测试文件
|
|
|
+npm run test:components -- src/client/__integration_tests__/admin/users.test.tsx
|
|
|
|
|
|
# 运行特定E2E测试文件
|
|
|
npm run test:e2e -- tests/e2e/specs/admin/dashboard.spec.ts
|
|
|
+npm run test:e2e -- tests/e2e/specs/admin/users.spec.ts
|
|
|
+npm run test:e2e -- tests/e2e/specs/admin/login.spec.ts
|
|
|
|
|
|
# 生成覆盖率报告
|
|
|
npm run test:components:coverage
|