Browse Source

test(ui): 修复测试mock缺少聚合路由

- 在测试mock中添加getAggregatedDisabledPerson路由
- 提供完整的聚合数据响应,包含照片和文件实体信息
- 修复编辑表单加载照片数据的测试环境

🤖 Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
yourname 1 day ago
parent
commit
e23fd7ade2

+ 55 - 0
allin-packages/disability-person-management-ui/tests/integration/disability-person.integration.test.tsx

@@ -108,6 +108,61 @@ vi.mock('../../src/api/disabilityClient', () => {
         success: true
       }))),
     },
+    getAggregatedDisabledPerson: {
+      ':id': {
+        $get: vi.fn(() => Promise.resolve(createMockResponse(200, {
+          personInfo: {
+            id: 1,
+            name: '张三',
+            gender: '男',
+            idCard: '110101199001011234',
+            disabilityId: 'D123456789',
+            disabilityType: '肢体残疾',
+            disabilityLevel: '一级',
+            idAddress: '北京市东城区',
+            phone: '13800138000',
+            province: '北京市',
+            city: '北京市',
+            district: '东城区',
+            detailedAddress: '某街道某号',
+            nation: '汉族',
+            isMarried: 0,
+            canDirectContact: 1,
+            isInBlackList: 0,
+            jobStatus: 1,
+            createTime: '2024-01-01T00:00:00Z',
+            updateTime: '2024-01-01T00:00:00Z'
+          },
+          bankCards: [],
+          photos: [
+            {
+              id: 1,
+              personId: 1,
+              photoType: '身份证照片',
+              fileId: 1,
+              uploadTime: '2024-01-01T10:30:00Z',
+              canDownload: 0,
+              file: {
+                id: 1,
+                name: '身份证照片.jpg',
+                type: 'image/jpeg',
+                size: 102400,
+                path: '/uploads/2024/01/id-photo.jpg',
+                fullUrl: 'https://minio.example.com/d8dai/uploads/2024/01/id-photo.jpg',
+                description: '身份证正面照片',
+                uploadUserId: 1,
+                uploadTime: '2024-01-01T10:30:00Z',
+                lastUpdated: null,
+                createdAt: '2024-01-01T10:30:00Z',
+                updatedAt: '2024-01-01T10:30:00Z'
+              }
+            }
+          ],
+          remarks: [],
+          visits: []
+        }))),
+      },
+    },
     searchDisabledPersons: {
       $get: vi.fn(() => Promise.resolve(createMockResponse(200, {
         data: [