|
@@ -10,7 +10,7 @@ import { BankName } from '@d8d/bank-names-module';
|
|
|
import { Company } from '@d8d/allin-company-module/entities';
|
|
import { Company } from '@d8d/allin-company-module/entities';
|
|
|
import { Platform } from '@d8d/allin-platform-module';
|
|
import { Platform } from '@d8d/allin-platform-module';
|
|
|
import { DataSource } from 'typeorm';
|
|
import { DataSource } from 'typeorm';
|
|
|
-import orderRoutes from '../../src/routes/order.routes';
|
|
|
|
|
|
|
+import orderRoutes, { enterpriseOrderRoutes } from '../../src/routes/order.routes';
|
|
|
import { EmploymentOrder } from '../../src/entities/employment-order.entity';
|
|
import { EmploymentOrder } from '../../src/entities/employment-order.entity';
|
|
|
import { OrderPerson } from '../../src/entities/order-person.entity';
|
|
import { OrderPerson } from '../../src/entities/order-person.entity';
|
|
|
import { OrderPersonAsset } from '../../src/entities/order-person-asset.entity';
|
|
import { OrderPersonAsset } from '../../src/entities/order-person-asset.entity';
|
|
@@ -23,6 +23,7 @@ setupIntegrationDatabaseHooksWithEntities([UserEntity, File, Role, Platform, Com
|
|
|
|
|
|
|
|
describe('订单管理API集成测试', () => {
|
|
describe('订单管理API集成测试', () => {
|
|
|
let client: ReturnType<typeof testClient<typeof orderRoutes>>;
|
|
let client: ReturnType<typeof testClient<typeof orderRoutes>>;
|
|
|
|
|
+ let enterpriseClient: ReturnType<typeof testClient<typeof enterpriseOrderRoutes>>;
|
|
|
let testToken: string;
|
|
let testToken: string;
|
|
|
let testUser: UserEntity;
|
|
let testUser: UserEntity;
|
|
|
let testFile: File;
|
|
let testFile: File;
|
|
@@ -31,6 +32,7 @@ describe('订单管理API集成测试', () => {
|
|
|
beforeEach(async () => {
|
|
beforeEach(async () => {
|
|
|
// 创建测试客户端
|
|
// 创建测试客户端
|
|
|
client = testClient(orderRoutes);
|
|
client = testClient(orderRoutes);
|
|
|
|
|
+ enterpriseClient = testClient(enterpriseOrderRoutes);
|
|
|
|
|
|
|
|
// 获取数据源
|
|
// 获取数据源
|
|
|
const dataSource = await IntegrationTestDatabase.getDataSource();
|
|
const dataSource = await IntegrationTestDatabase.getDataSource();
|
|
@@ -1223,7 +1225,7 @@ describe('订单管理API集成测试', () => {
|
|
|
|
|
|
|
|
describe('GET /order/company-videos', () => {
|
|
describe('GET /order/company-videos', () => {
|
|
|
it('应该返回企业维度视频列表', async () => {
|
|
it('应该返回企业维度视频列表', async () => {
|
|
|
- const response = await client['company-videos'].$get({
|
|
|
|
|
|
|
+ const response = await enterpriseClient['company-videos'].$get({
|
|
|
query: {
|
|
query: {
|
|
|
companyId: testCompany.id.toString()
|
|
companyId: testCompany.id.toString()
|
|
|
}
|
|
}
|
|
@@ -1252,7 +1254,7 @@ describe('订单管理API集成测试', () => {
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
it('应该支持按视频类型过滤', async () => {
|
|
it('应该支持按视频类型过滤', async () => {
|
|
|
- const response = await client['company-videos'].$get({
|
|
|
|
|
|
|
+ const response = await enterpriseClient['company-videos'].$get({
|
|
|
query: {
|
|
query: {
|
|
|
companyId: testCompany.id.toString(),
|
|
companyId: testCompany.id.toString(),
|
|
|
assetType: AssetType.CHECKIN_VIDEO
|
|
assetType: AssetType.CHECKIN_VIDEO
|
|
@@ -1273,7 +1275,7 @@ describe('订单管理API集成测试', () => {
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
it('应该支持分页查询', async () => {
|
|
it('应该支持分页查询', async () => {
|
|
|
- const response = await client['company-videos'].$get({
|
|
|
|
|
|
|
+ const response = await enterpriseClient['company-videos'].$get({
|
|
|
query: {
|
|
query: {
|
|
|
companyId: testCompany.id.toString(),
|
|
companyId: testCompany.id.toString(),
|
|
|
page: '1',
|
|
page: '1',
|
|
@@ -1295,7 +1297,7 @@ describe('订单管理API集成测试', () => {
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
it('应该支持按关联时间排序', async () => {
|
|
it('应该支持按关联时间排序', async () => {
|
|
|
- const response = await client['company-videos'].$get({
|
|
|
|
|
|
|
+ const response = await enterpriseClient['company-videos'].$get({
|
|
|
query: {
|
|
query: {
|
|
|
companyId: testCompany.id.toString(),
|
|
companyId: testCompany.id.toString(),
|
|
|
sortBy: 'relatedTime',
|
|
sortBy: 'relatedTime',
|
|
@@ -1320,7 +1322,7 @@ describe('订单管理API集成测试', () => {
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
it('应该验证企业ID必填', async () => {
|
|
it('应该验证企业ID必填', async () => {
|
|
|
- const response = await client['company-videos'].$get({
|
|
|
|
|
|
|
+ const response = await enterpriseClient['company-videos'].$get({
|
|
|
query: {}
|
|
query: {}
|
|
|
}, {
|
|
}, {
|
|
|
headers: {
|
|
headers: {
|
|
@@ -1340,7 +1342,7 @@ describe('订单管理API集成测试', () => {
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
it('应该验证企业ID有效性', async () => {
|
|
it('应该验证企业ID有效性', async () => {
|
|
|
- const response = await client['company-videos'].$get({
|
|
|
|
|
|
|
+ const response = await enterpriseClient['company-videos'].$get({
|
|
|
query: {
|
|
query: {
|
|
|
companyId: '999999' // 不存在的企业ID
|
|
companyId: '999999' // 不存在的企业ID
|
|
|
}
|
|
}
|
|
@@ -1371,7 +1373,7 @@ describe('订单管理API集成测试', () => {
|
|
|
assetTypes: [AssetType.CHECKIN_VIDEO, AssetType.WORK_VIDEO]
|
|
assetTypes: [AssetType.CHECKIN_VIDEO, AssetType.WORK_VIDEO]
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- const response = await client['batch-download'].$post({
|
|
|
|
|
|
|
+ const response = await enterpriseClient['batch-download'].$post({
|
|
|
json: requestData
|
|
json: requestData
|
|
|
}, {
|
|
}, {
|
|
|
headers: {
|
|
headers: {
|
|
@@ -1409,7 +1411,7 @@ describe('订单管理API集成测试', () => {
|
|
|
assetTypes: [AssetType.CHECKIN_VIDEO]
|
|
assetTypes: [AssetType.CHECKIN_VIDEO]
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- const response = await client['batch-download'].$post({
|
|
|
|
|
|
|
+ const response = await enterpriseClient['batch-download'].$post({
|
|
|
json: requestData
|
|
json: requestData
|
|
|
}, {
|
|
}, {
|
|
|
headers: {
|
|
headers: {
|
|
@@ -1434,7 +1436,7 @@ describe('订单管理API集成测试', () => {
|
|
|
// 缺少personId
|
|
// 缺少personId
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- const response = await client['batch-download'].$post({
|
|
|
|
|
|
|
+ const response = await enterpriseClient['batch-download'].$post({
|
|
|
json: requestData
|
|
json: requestData
|
|
|
}, {
|
|
}, {
|
|
|
headers: {
|
|
headers: {
|
|
@@ -1455,7 +1457,7 @@ describe('订单管理API集成测试', () => {
|
|
|
fileIds: fileIds
|
|
fileIds: fileIds
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- const response = await client['batch-download'].$post({
|
|
|
|
|
|
|
+ const response = await enterpriseClient['batch-download'].$post({
|
|
|
json: requestData
|
|
json: requestData
|
|
|
}, {
|
|
}, {
|
|
|
headers: {
|
|
headers: {
|
|
@@ -1484,7 +1486,7 @@ describe('订单管理API集成测试', () => {
|
|
|
assetTypes: [AssetType.CHECKIN_VIDEO]
|
|
assetTypes: [AssetType.CHECKIN_VIDEO]
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- const response = await client['batch-download'].$post({
|
|
|
|
|
|
|
+ const response = await enterpriseClient['batch-download'].$post({
|
|
|
json: requestData
|
|
json: requestData
|
|
|
}, {
|
|
}, {
|
|
|
headers: {
|
|
headers: {
|
|
@@ -1511,7 +1513,7 @@ describe('订单管理API集成测试', () => {
|
|
|
status: AssetStatus.VERIFIED as const
|
|
status: AssetStatus.VERIFIED as const
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- const response = await client.videos[':id'].status.$put({
|
|
|
|
|
|
|
+ const response = await enterpriseClient.videos[':id'].status.$put({
|
|
|
param: { id: testAsset.id.toString() },
|
|
param: { id: testAsset.id.toString() },
|
|
|
json: requestData
|
|
json: requestData
|
|
|
}, {
|
|
}, {
|
|
@@ -1543,7 +1545,7 @@ describe('订单管理API集成测试', () => {
|
|
|
status: AssetStatus.REJECTED as const
|
|
status: AssetStatus.REJECTED as const
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- const response = await client.videos[':id'].status.$put({
|
|
|
|
|
|
|
+ const response = await enterpriseClient.videos[':id'].status.$put({
|
|
|
param: { id: testAsset.id.toString() },
|
|
param: { id: testAsset.id.toString() },
|
|
|
json: requestData
|
|
json: requestData
|
|
|
}, {
|
|
}, {
|
|
@@ -1565,7 +1567,7 @@ describe('订单管理API集成测试', () => {
|
|
|
status: AssetStatus.VERIFIED as const
|
|
status: AssetStatus.VERIFIED as const
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- const response = await client.videos[':id'].status.$put({
|
|
|
|
|
|
|
+ const response = await enterpriseClient.videos[':id'].status.$put({
|
|
|
param: { id: '999999' },
|
|
param: { id: '999999' },
|
|
|
json: requestData
|
|
json: requestData
|
|
|
}, {
|
|
}, {
|
|
@@ -1583,7 +1585,7 @@ describe('订单管理API集成测试', () => {
|
|
|
status: 'invalid_status' as any // 无效的状态
|
|
status: 'invalid_status' as any // 无效的状态
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- const response = await client.videos[':id'].status.$put({
|
|
|
|
|
|
|
+ const response = await enterpriseClient.videos[':id'].status.$put({
|
|
|
param: { id: testAsset.id.toString() },
|
|
param: { id: testAsset.id.toString() },
|
|
|
json: requestData
|
|
json: requestData
|
|
|
}, {
|
|
}, {
|
|
@@ -1601,7 +1603,7 @@ describe('订单管理API集成测试', () => {
|
|
|
status: AssetStatus.PENDING as const
|
|
status: AssetStatus.PENDING as const
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- const response = await client.videos[':id'].status.$put({
|
|
|
|
|
|
|
+ const response = await enterpriseClient.videos[':id'].status.$put({
|
|
|
param: { id: testAsset.id.toString() },
|
|
param: { id: testAsset.id.toString() },
|
|
|
json: requestData
|
|
json: requestData
|
|
|
}, {
|
|
}, {
|