|
@@ -1,21 +1,17 @@
|
|
|
import { describe, it, expect, beforeEach } from 'vitest';
|
|
import { describe, it, expect, beforeEach } from 'vitest';
|
|
|
import { testClient } from 'hono/testing';
|
|
import { testClient } from 'hono/testing';
|
|
|
import { IntegrationTestDatabase, setupIntegrationDatabaseHooksWithEntities } from '@d8d/shared-test-util';
|
|
import { IntegrationTestDatabase, setupIntegrationDatabaseHooksWithEntities } from '@d8d/shared-test-util';
|
|
|
-import { JWTUtil, parseWithAwait } from '@d8d/shared-utils';
|
|
|
|
|
|
|
+import { JWTUtil } from '@d8d/shared-utils';
|
|
|
import { JWTPayload } from '@d8d/shared-types';
|
|
import { JWTPayload } from '@d8d/shared-types';
|
|
|
import { UserEntity, Role } from '@d8d/user-module';
|
|
import { UserEntity, Role } from '@d8d/user-module';
|
|
|
import { File } from '@d8d/file-module';
|
|
import { File } from '@d8d/file-module';
|
|
|
import { Platform } from '@d8d/allin-platform-module/entities';
|
|
import { Platform } from '@d8d/allin-platform-module/entities';
|
|
|
import { EmploymentOrder, OrderPerson, OrderPersonAsset } from '@d8d/allin-order-module/entities';
|
|
import { EmploymentOrder, OrderPerson, OrderPersonAsset } from '@d8d/allin-order-module/entities';
|
|
|
|
|
+import { AssetType, AssetFileType } from '@d8d/allin-order-module/schemas';
|
|
|
|
|
+import { OrderStatus, WorkStatus } from '@d8d/allin-order-module/schemas';
|
|
|
import { BankName } from '@d8d/bank-names-module';
|
|
import { BankName } from '@d8d/bank-names-module';
|
|
|
import { DisabledPerson, DisabledBankCard, DisabledPhoto, DisabledRemark, DisabledVisit } from '../../src/entities';
|
|
import { DisabledPerson, DisabledBankCard, DisabledPhoto, DisabledRemark, DisabledVisit } from '../../src/entities';
|
|
|
import personExtensionRoutes from '../../src/routes/person-extension.route';
|
|
import personExtensionRoutes from '../../src/routes/person-extension.route';
|
|
|
-import {
|
|
|
|
|
- WorkHistoryResponseSchema,
|
|
|
|
|
- SalaryHistoryResponseSchema,
|
|
|
|
|
- CreditInfoResponseSchema,
|
|
|
|
|
- PersonVideosResponseSchema
|
|
|
|
|
-} from '../../src/schemas/person-extension.schema';
|
|
|
|
|
import { Company } from '@d8d/allin-company-module/entities';
|
|
import { Company } from '@d8d/allin-company-module/entities';
|
|
|
|
|
|
|
|
// 设置集成测试钩子 - 需要包含所有相关实体
|
|
// 设置集成测试钩子 - 需要包含所有相关实体
|
|
@@ -97,8 +93,8 @@ describe('人才扩展API集成测试', () => {
|
|
|
phone: '13800138000',
|
|
phone: '13800138000',
|
|
|
province: '北京市',
|
|
province: '北京市',
|
|
|
city: '北京市',
|
|
city: '北京市',
|
|
|
- address: '测试地址'
|
|
|
|
|
- } as any);
|
|
|
|
|
|
|
+ detailedAddress: '测试地址'
|
|
|
|
|
+ });
|
|
|
await disabledPersonRepo.save(testDisabledPerson);
|
|
await disabledPersonRepo.save(testDisabledPerson);
|
|
|
|
|
|
|
|
// 创建测试订单
|
|
// 创建测试订单
|
|
@@ -107,9 +103,9 @@ describe('人才扩展API集成测试', () => {
|
|
|
orderName: '测试订单',
|
|
orderName: '测试订单',
|
|
|
platformId: testPlatform.id,
|
|
platformId: testPlatform.id,
|
|
|
companyId: testCompany.id,
|
|
companyId: testCompany.id,
|
|
|
- orderStatus: 'confirmed',
|
|
|
|
|
- workStatus: 'working'
|
|
|
|
|
- } as any);
|
|
|
|
|
|
|
+ orderStatus: OrderStatus.CONFIRMED,
|
|
|
|
|
+ workStatus: WorkStatus.WORKING
|
|
|
|
|
+ });
|
|
|
await orderRepo.save(testOrder);
|
|
await orderRepo.save(testOrder);
|
|
|
|
|
|
|
|
// 创建订单人员关联,使人员属于该企业
|
|
// 创建订单人员关联,使人员属于该企业
|
|
@@ -118,9 +114,9 @@ describe('人才扩展API集成测试', () => {
|
|
|
orderId: testOrder.id,
|
|
orderId: testOrder.id,
|
|
|
personId: testDisabledPerson.id,
|
|
personId: testDisabledPerson.id,
|
|
|
joinDate: new Date('2024-01-01'),
|
|
joinDate: new Date('2024-01-01'),
|
|
|
- workStatus: 'working',
|
|
|
|
|
|
|
+ workStatus: WorkStatus.WORKING,
|
|
|
salaryDetail: 5000.00
|
|
salaryDetail: 5000.00
|
|
|
- } as any);
|
|
|
|
|
|
|
+ });
|
|
|
await orderPersonRepo.save(orderPerson);
|
|
await orderPersonRepo.save(orderPerson);
|
|
|
});
|
|
});
|
|
|
|
|
|
|
@@ -136,9 +132,9 @@ describe('人才扩展API集成测试', () => {
|
|
|
orderName: '另一个测试订单',
|
|
orderName: '另一个测试订单',
|
|
|
platformId: testPlatform.id,
|
|
platformId: testPlatform.id,
|
|
|
companyId: testCompany.id,
|
|
companyId: testCompany.id,
|
|
|
- orderStatus: 'completed',
|
|
|
|
|
- workStatus: 'working'
|
|
|
|
|
- } as any);
|
|
|
|
|
|
|
+ orderStatus: OrderStatus.COMPLETED,
|
|
|
|
|
+ workStatus: WorkStatus.WORKING
|
|
|
|
|
+ });
|
|
|
await orderRepo.save(anotherOrder);
|
|
await orderRepo.save(anotherOrder);
|
|
|
|
|
|
|
|
const anotherOrderPerson = orderPersonRepo.create({
|
|
const anotherOrderPerson = orderPersonRepo.create({
|
|
@@ -147,9 +143,9 @@ describe('人才扩展API集成测试', () => {
|
|
|
joinDate: new Date('2024-06-01'),
|
|
joinDate: new Date('2024-06-01'),
|
|
|
actualStartDate: new Date('2024-06-02'),
|
|
actualStartDate: new Date('2024-06-02'),
|
|
|
leaveDate: new Date('2024-12-31'),
|
|
leaveDate: new Date('2024-12-31'),
|
|
|
- workStatus: 'resigned',
|
|
|
|
|
|
|
+ workStatus: WorkStatus.RESIGNED,
|
|
|
salaryDetail: 6000.00
|
|
salaryDetail: 6000.00
|
|
|
- } as any);
|
|
|
|
|
|
|
+ });
|
|
|
await orderPersonRepo.save(anotherOrderPerson);
|
|
await orderPersonRepo.save(anotherOrderPerson);
|
|
|
|
|
|
|
|
// 调用API
|
|
// 调用API
|
|
@@ -222,8 +218,8 @@ describe('人才扩展API集成测试', () => {
|
|
|
phone: '13900139000',
|
|
phone: '13900139000',
|
|
|
province: '上海市',
|
|
province: '上海市',
|
|
|
city: '上海市',
|
|
city: '上海市',
|
|
|
- address: '其他地址'
|
|
|
|
|
- } as any);
|
|
|
|
|
|
|
+ detailedAddress: '其他地址'
|
|
|
|
|
+ });
|
|
|
await disabledPersonRepo.save(otherDisabledPerson);
|
|
await disabledPersonRepo.save(otherDisabledPerson);
|
|
|
|
|
|
|
|
// 尝试访问其他公司人员数据
|
|
// 尝试访问其他公司人员数据
|
|
@@ -251,7 +247,7 @@ describe('人才扩展API集成测试', () => {
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
expect(response.status).toBe(200);
|
|
expect(response.status).toBe(200);
|
|
|
- const data = await response.json();
|
|
|
|
|
|
|
+ const data = await response.json() as { 薪资历史: any[] };
|
|
|
|
|
|
|
|
// 验证响应结构
|
|
// 验证响应结构
|
|
|
expect(data).toHaveProperty('薪资历史');
|
|
expect(data).toHaveProperty('薪资历史');
|
|
@@ -283,7 +279,7 @@ describe('人才扩展API集成测试', () => {
|
|
|
name: '测试银行',
|
|
name: '测试银行',
|
|
|
code: 'TESTBANK',
|
|
code: 'TESTBANK',
|
|
|
status: 1
|
|
status: 1
|
|
|
- } as any);
|
|
|
|
|
|
|
+ });
|
|
|
await bankNameRepo.save(bankName);
|
|
await bankNameRepo.save(bankName);
|
|
|
|
|
|
|
|
// 创建银行卡记录
|
|
// 创建银行卡记录
|
|
@@ -310,7 +306,7 @@ describe('人才扩展API集成测试', () => {
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
expect(response.status).toBe(200);
|
|
expect(response.status).toBe(200);
|
|
|
- const data = await response.json();
|
|
|
|
|
|
|
+ const data = await response.json() as { 征信信息: any[] };
|
|
|
|
|
|
|
|
// 验证响应结构
|
|
// 验证响应结构
|
|
|
expect(data).toHaveProperty('征信信息');
|
|
expect(data).toHaveProperty('征信信息');
|
|
@@ -348,11 +344,11 @@ describe('人才扩展API集成测试', () => {
|
|
|
const asset = assetRepo.create({
|
|
const asset = assetRepo.create({
|
|
|
orderId: testOrder.id,
|
|
orderId: testOrder.id,
|
|
|
personId: testDisabledPerson.id,
|
|
personId: testDisabledPerson.id,
|
|
|
- assetType: 'work_video',
|
|
|
|
|
- assetFileType: 'video',
|
|
|
|
|
|
|
+ assetType: AssetType.WORK_VIDEO,
|
|
|
|
|
+ assetFileType: AssetFileType.VIDEO,
|
|
|
fileId: testFile.id,
|
|
fileId: testFile.id,
|
|
|
relatedTime: new Date()
|
|
relatedTime: new Date()
|
|
|
- } as any);
|
|
|
|
|
|
|
+ });
|
|
|
await assetRepo.save(asset);
|
|
await assetRepo.save(asset);
|
|
|
|
|
|
|
|
// 调用API
|
|
// 调用API
|
|
@@ -365,7 +361,7 @@ describe('人才扩展API集成测试', () => {
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
expect(response.status).toBe(200);
|
|
expect(response.status).toBe(200);
|
|
|
- const data = await response.json();
|
|
|
|
|
|
|
+ const data = await response.json() as { 视频列表: any[] };
|
|
|
|
|
|
|
|
// 验证响应结构
|
|
// 验证响应结构
|
|
|
expect(data).toHaveProperty('视频列表');
|
|
expect(data).toHaveProperty('视频列表');
|