|
|
@@ -105,7 +105,7 @@ describe('企业统计API集成测试', () => {
|
|
|
orderName: '测试订单',
|
|
|
platformId: testPlatform.id,
|
|
|
companyId: testCompany.id,
|
|
|
- orderStatus: 'confirmed',
|
|
|
+ orderStatus: 'in_progress',
|
|
|
workStatus: 'working'
|
|
|
});
|
|
|
await orderRepo.save(order);
|
|
|
@@ -122,8 +122,8 @@ describe('企业统计API集成测试', () => {
|
|
|
await orderPersonRepo.save(orderPerson);
|
|
|
|
|
|
// 调用API
|
|
|
- const response = await client.overview.$get({
|
|
|
- header: {
|
|
|
+ const response = await client.overview.$get({},{
|
|
|
+ headers: {
|
|
|
Authorization: `Bearer ${testToken}`
|
|
|
}
|
|
|
});
|
|
|
@@ -134,8 +134,8 @@ describe('企业统计API集成测试', () => {
|
|
|
// 验证响应结构
|
|
|
expect(data).toHaveProperty('在职人员数');
|
|
|
expect(data).toHaveProperty('进行中订单数');
|
|
|
- expect(data).toHaveProperty('累计用工时长');
|
|
|
- expect(data).toHaveProperty('平均薪资');
|
|
|
+ expect(data).toHaveProperty('已完成订单数');
|
|
|
+ expect(data).toHaveProperty('累计订单数');
|
|
|
|
|
|
// 验证数据
|
|
|
expect(data.在职人员数).toBe(1);
|
|
|
@@ -166,8 +166,8 @@ describe('企业统计API集成测试', () => {
|
|
|
roles: [{ name: 'user' }]
|
|
|
});
|
|
|
|
|
|
- const response = await client.overview.$get({
|
|
|
- header: {
|
|
|
+ const response = await client.overview.$get({},{
|
|
|
+ headers: {
|
|
|
Authorization: `Bearer ${nonEnterpriseToken}`
|
|
|
}
|
|
|
});
|
|
|
@@ -209,7 +209,7 @@ describe('企业统计API集成测试', () => {
|
|
|
orderName: '测试订单',
|
|
|
platformId: testPlatform.id,
|
|
|
companyId: testCompany.id,
|
|
|
- orderStatus: 'confirmed',
|
|
|
+ orderStatus: 'in_progress',
|
|
|
workStatus: 'working'
|
|
|
});
|
|
|
await orderRepo.save(order);
|
|
|
@@ -230,8 +230,9 @@ describe('企业统计API集成测试', () => {
|
|
|
|
|
|
// 调用API
|
|
|
const response = await client[':id'].talents.$get({
|
|
|
- param: { id: testCompany.id },
|
|
|
- header: {
|
|
|
+ param: { id: testCompany.id }
|
|
|
+ },{
|
|
|
+ headers: {
|
|
|
Authorization: `Bearer ${testToken}`
|
|
|
}
|
|
|
});
|
|
|
@@ -247,14 +248,13 @@ describe('企业统计API集成测试', () => {
|
|
|
|
|
|
// 验证响应结构
|
|
|
expect(data).toHaveProperty('人才列表');
|
|
|
- expect(data).toHaveProperty('分页信息');
|
|
|
+ expect(data).toHaveProperty('状态分布');
|
|
|
expect(Array.isArray(data.人才列表)).toBe(true);
|
|
|
|
|
|
- // 验证分页
|
|
|
- expect(data.分页信息).toHaveProperty('当前页');
|
|
|
- expect(data.分页信息).toHaveProperty('每页数量');
|
|
|
- expect(data.分页信息).toHaveProperty('总记录数');
|
|
|
- expect(data.分页信息).toHaveProperty('总页数');
|
|
|
+ // 验证状态分布
|
|
|
+ expect(data.状态分布).toHaveProperty('working');
|
|
|
+ expect(data.状态分布).toHaveProperty('on_leave');
|
|
|
+ expect(data.状态分布).toHaveProperty('left');
|
|
|
});
|
|
|
|
|
|
it('访问其他企业数据应该返回403', async () => {
|
|
|
@@ -274,8 +274,9 @@ describe('企业统计API集成测试', () => {
|
|
|
|
|
|
// 尝试访问其他公司数据
|
|
|
const response = await client[':id'].talents.$get({
|
|
|
- param: { id: otherCompany.id },
|
|
|
- header: {
|
|
|
+ param: { id: otherCompany.id }
|
|
|
+ },{
|
|
|
+ headers: {
|
|
|
Authorization: `Bearer ${testToken}`
|
|
|
}
|
|
|
});
|