|
|
@@ -81,6 +81,37 @@ vi.mock('../../src/api/disabilityClient', () => {
|
|
|
updateTime: '2024-01-02T00:00:00Z'
|
|
|
}))),
|
|
|
},
|
|
|
+ createAggregatedDisabledPerson: {
|
|
|
+ $post: vi.fn(() => Promise.resolve(createMockResponse(200, {
|
|
|
+ personInfo: {
|
|
|
+ id: 2,
|
|
|
+ name: '李四',
|
|
|
+ gender: '女',
|
|
|
+ idCard: '110101199002021234',
|
|
|
+ disabilityId: 'D123456790',
|
|
|
+ disabilityType: '视力残疾',
|
|
|
+ disabilityLevel: '二级',
|
|
|
+ idAddress: '上海市黄浦区',
|
|
|
+ phone: '13900139000',
|
|
|
+ province: '上海市',
|
|
|
+ city: '上海市',
|
|
|
+ district: '黄浦区',
|
|
|
+ detailedAddress: '某街道某号',
|
|
|
+ nation: '汉族',
|
|
|
+ isMarried: 1,
|
|
|
+ canDirectContact: 1,
|
|
|
+ isInBlackList: 0,
|
|
|
+ jobStatus: 0,
|
|
|
+ specificDisability: '双眼视力均为0.05,需要导盲犬辅助',
|
|
|
+ createTime: '2024-01-02T00:00:00Z',
|
|
|
+ updateTime: '2024-01-02T00:00:00Z'
|
|
|
+ },
|
|
|
+ bankCards: [],
|
|
|
+ photos: [],
|
|
|
+ remarks: [],
|
|
|
+ visits: []
|
|
|
+ }))),
|
|
|
+ },
|
|
|
updateDisabledPerson: {
|
|
|
$post: vi.fn(() => Promise.resolve(createMockResponse(200, {
|
|
|
id: 1,
|
|
|
@@ -106,6 +137,39 @@ vi.mock('../../src/api/disabilityClient', () => {
|
|
|
updateTime: '2024-01-03T00:00:00Z'
|
|
|
}))),
|
|
|
},
|
|
|
+ updateAggregatedDisabledPerson: {
|
|
|
+ ':id': {
|
|
|
+ $put: vi.fn(() => Promise.resolve(createMockResponse(200, {
|
|
|
+ personInfo: {
|
|
|
+ id: 1,
|
|
|
+ name: '张三(已更新)',
|
|
|
+ gender: '男',
|
|
|
+ idCard: '110101199001011234',
|
|
|
+ disabilityId: 'D123456789',
|
|
|
+ disabilityType: '肢体残疾',
|
|
|
+ disabilityLevel: '一级',
|
|
|
+ idAddress: '北京市东城区',
|
|
|
+ phone: '13800138001',
|
|
|
+ province: '北京市',
|
|
|
+ city: '北京市',
|
|
|
+ district: '东城区',
|
|
|
+ detailedAddress: '更新后的地址',
|
|
|
+ nation: '汉族',
|
|
|
+ isMarried: 1,
|
|
|
+ canDirectContact: 1,
|
|
|
+ isInBlackList: 0,
|
|
|
+ jobStatus: 1,
|
|
|
+ specificDisability: '左腿截肢,右腿行动不便,需要轮椅',
|
|
|
+ createTime: '2024-01-01T00:00:00Z',
|
|
|
+ updateTime: '2024-01-03T00:00:00Z'
|
|
|
+ },
|
|
|
+ bankCards: [],
|
|
|
+ photos: [],
|
|
|
+ remarks: [],
|
|
|
+ visits: []
|
|
|
+ }))),
|
|
|
+ },
|
|
|
+ },
|
|
|
deleteDisabledPerson: {
|
|
|
$post: vi.fn(() => Promise.resolve(createMockResponse(200, {
|
|
|
success: true
|
|
|
@@ -459,12 +523,12 @@ describe('残疾人个人管理集成测试', () => {
|
|
|
// 验证API调用 - 增加等待时间
|
|
|
await waitFor(() => {
|
|
|
const mockClient = (disabilityClientManager.get as any)();
|
|
|
- expect(mockClient.createDisabledPerson.$post).toHaveBeenCalled();
|
|
|
+ expect(mockClient.createAggregatedDisabledPerson.$post).toHaveBeenCalled();
|
|
|
}, { timeout: 3000 });
|
|
|
|
|
|
// 验证具体的调用参数
|
|
|
const mockClient = (disabilityClientManager.get as any)();
|
|
|
- const call = mockClient.createDisabledPerson.$post.mock.calls[0];
|
|
|
+ const call = mockClient.createAggregatedDisabledPerson.$post.mock.calls[0];
|
|
|
expect(call).toBeDefined();
|
|
|
|
|
|
if (call) {
|
|
|
@@ -506,7 +570,7 @@ describe('残疾人个人管理集成测试', () => {
|
|
|
// 验证API调用
|
|
|
await waitFor(() => {
|
|
|
const mockClient = (disabilityClientManager.get as any)();
|
|
|
- expect(mockClient.updateDisabledPerson.$post).toHaveBeenCalledWith({
|
|
|
+ expect(mockClient.updateAggregatedDisabledPerson[':id']['$put']).toHaveBeenCalledWith({
|
|
|
json: expect.objectContaining({
|
|
|
id: 1,
|
|
|
phone: '13800138001',
|
|
|
@@ -723,12 +787,12 @@ describe('残疾人个人管理集成测试', () => {
|
|
|
// 验证API调用包含specificDisability字段
|
|
|
await waitFor(() => {
|
|
|
const mockClient = (disabilityClientManager.get as any)();
|
|
|
- expect(mockClient.createDisabledPerson.$post).toHaveBeenCalled();
|
|
|
+ expect(mockClient.createAggregatedDisabledPerson.$post).toHaveBeenCalled();
|
|
|
}, { timeout: 3000 });
|
|
|
|
|
|
// 验证具体的调用参数包含specificDisability
|
|
|
const mockClient = (disabilityClientManager.get as any)();
|
|
|
- const call = mockClient.createDisabledPerson.$post.mock.calls[0];
|
|
|
+ const call = mockClient.createAggregatedDisabledPerson.$post.mock.calls[0];
|
|
|
expect(call).toBeDefined();
|
|
|
|
|
|
if (call) {
|