|
|
@@ -6,14 +6,15 @@ import { UserEntity, Role } from '@d8d/user-module';
|
|
|
import { File } from '@d8d/file-module';
|
|
|
import { Platform } from '@d8d/allin-platform-module/entities';
|
|
|
import { EmploymentOrder, OrderPerson } from '@d8d/allin-order-module/entities';
|
|
|
-import { DisabledPerson } from '@d8d/allin-disability-module/entities';
|
|
|
+import { DisabledPerson, DisabledBankCard, DisabledPhoto, DisabledRemark, DisabledVisit } from '@d8d/allin-disability-module/entities';
|
|
|
+import { BankName } from '@d8d/bank-names-module';
|
|
|
import companyStatisticsRoutes from '../../src/routes/company-statistics.route';
|
|
|
import { Company } from '../../src/entities/company.entity';
|
|
|
|
|
|
// 设置集成测试钩子 - 需要包含所有相关实体
|
|
|
setupIntegrationDatabaseHooksWithEntities([
|
|
|
UserEntity, File, Role, Platform, Company,
|
|
|
- EmploymentOrder, OrderPerson, DisabledPerson
|
|
|
+ EmploymentOrder, OrderPerson, DisabledPerson, BankName, DisabledBankCard, DisabledPhoto, DisabledRemark, DisabledVisit
|
|
|
])
|
|
|
|
|
|
describe('企业统计API集成测试', () => {
|
|
|
@@ -85,10 +86,15 @@ describe('企业统计API集成测试', () => {
|
|
|
const disabledPerson = disabledPersonRepo.create({
|
|
|
name: '测试残疾人',
|
|
|
idCard: `110101${Date.now() % 100000000}`,
|
|
|
- gender: 1,
|
|
|
+ gender: '男',
|
|
|
birthDate: new Date('1990-01-01'),
|
|
|
disabilityType: '视力残疾',
|
|
|
disabilityLevel: '一级',
|
|
|
+ disabilityId: `DIS${Date.now() % 100000000}`,
|
|
|
+ idAddress: '身份证地址',
|
|
|
+ phone: '13800138000',
|
|
|
+ province: '北京市',
|
|
|
+ city: '北京市',
|
|
|
address: '测试地址'
|
|
|
});
|
|
|
await disabledPersonRepo.save(disabledPerson);
|
|
|
@@ -127,13 +133,13 @@ describe('企业统计API集成测试', () => {
|
|
|
|
|
|
// 验证响应结构
|
|
|
expect(data).toHaveProperty('在职人员数');
|
|
|
- expect(data).toHaveProperty('订单数');
|
|
|
+ expect(data).toHaveProperty('进行中订单数');
|
|
|
expect(data).toHaveProperty('累计用工时长');
|
|
|
expect(data).toHaveProperty('平均薪资');
|
|
|
|
|
|
// 验证数据
|
|
|
expect(data.在职人员数).toBe(1);
|
|
|
- expect(data.订单数).toBe(1);
|
|
|
+ expect(data.进行中订单数).toBe(1);
|
|
|
});
|
|
|
|
|
|
it('未认证用户应该返回401', async () => {
|
|
|
@@ -182,10 +188,15 @@ describe('企业统计API集成测试', () => {
|
|
|
const person = disabledPersonRepo.create({
|
|
|
name: `测试残疾人${i}`,
|
|
|
idCard: `110101${Date.now() % 100000000 + i}`,
|
|
|
- gender: i % 2 + 1,
|
|
|
+ gender: i % 2 === 0 ? '男' : '女',
|
|
|
birthDate: new Date('1990-01-01'),
|
|
|
disabilityType: '视力残疾',
|
|
|
disabilityLevel: '一级',
|
|
|
+ disabilityId: `DIS${Date.now() % 100000000 + i}`,
|
|
|
+ idAddress: '身份证地址',
|
|
|
+ phone: `1380013800${i}`,
|
|
|
+ province: '北京市',
|
|
|
+ city: '北京市',
|
|
|
address: '测试地址'
|
|
|
});
|
|
|
await disabledPersonRepo.save(person);
|
|
|
@@ -205,7 +216,8 @@ describe('企业统计API集成测试', () => {
|
|
|
|
|
|
// 创建订单人员关联
|
|
|
const orderPersonRepo = dataSource.getRepository(OrderPerson);
|
|
|
- for (const person of disabledPersons) {
|
|
|
+ for (let i = 0; i < disabledPersons.length; i++) {
|
|
|
+ const person = disabledPersons[i];
|
|
|
const orderPerson = orderPersonRepo.create({
|
|
|
orderId: order.id,
|
|
|
personId: person.id,
|