|
@@ -1,7 +1,7 @@
|
|
|
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 } from '@d8d/shared-utils';
|
|
|
|
|
|
|
+import { JWTUtil, parseWithAwait } from '@d8d/shared-utils';
|
|
|
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';
|
|
@@ -9,6 +9,12 @@ import { EmploymentOrder, OrderPerson, OrderPersonAsset } from '@d8d/allin-order
|
|
|
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';
|
|
|
|
|
|
|
|
// 设置集成测试钩子 - 需要包含所有相关实体
|
|
// 设置集成测试钩子 - 需要包含所有相关实体
|
|
@@ -149,7 +155,8 @@ describe('人才扩展API集成测试', () => {
|
|
|
|
|
|
|
|
// 调用API
|
|
// 调用API
|
|
|
const response = await client[':id']['work-history'].$get({
|
|
const response = await client[':id']['work-history'].$get({
|
|
|
- param: { id: testDisabledPerson.id },
|
|
|
|
|
|
|
+ param: { id: testDisabledPerson.id }
|
|
|
|
|
+ },{
|
|
|
headers: {
|
|
headers: {
|
|
|
Authorization: `Bearer ${testToken}`
|
|
Authorization: `Bearer ${testToken}`
|
|
|
}
|
|
}
|
|
@@ -222,7 +229,8 @@ describe('人才扩展API集成测试', () => {
|
|
|
|
|
|
|
|
// 尝试访问其他公司人员数据
|
|
// 尝试访问其他公司人员数据
|
|
|
const response = await client[':id']['work-history'].$get({
|
|
const response = await client[':id']['work-history'].$get({
|
|
|
- param: { id: otherDisabledPerson.id },
|
|
|
|
|
|
|
+ param: { id: otherDisabledPerson.id }
|
|
|
|
|
+ },{
|
|
|
headers: {
|
|
headers: {
|
|
|
Authorization: `Bearer ${testToken}`
|
|
Authorization: `Bearer ${testToken}`
|
|
|
}
|
|
}
|
|
@@ -236,7 +244,8 @@ describe('人才扩展API集成测试', () => {
|
|
|
it('应该返回人员薪资历史', async () => {
|
|
it('应该返回人员薪资历史', async () => {
|
|
|
// 注意:薪资历史可能需要从薪资模块获取,这里暂时返回空数组
|
|
// 注意:薪资历史可能需要从薪资模块获取,这里暂时返回空数组
|
|
|
const response = await client[':id']['salary-history'].$get({
|
|
const response = await client[':id']['salary-history'].$get({
|
|
|
- param: { id: testDisabledPerson.id },
|
|
|
|
|
|
|
+ param: { id: testDisabledPerson.id }
|
|
|
|
|
+ },{
|
|
|
headers: {
|
|
headers: {
|
|
|
Authorization: `Bearer ${testToken}`
|
|
Authorization: `Bearer ${testToken}`
|
|
|
}
|
|
}
|
|
@@ -272,8 +281,8 @@ describe('人才扩展API集成测试', () => {
|
|
|
// 创建银行名称记录
|
|
// 创建银行名称记录
|
|
|
const bankNameRepo = dataSource.getRepository(BankName);
|
|
const bankNameRepo = dataSource.getRepository(BankName);
|
|
|
const bankName = bankNameRepo.create({
|
|
const bankName = bankNameRepo.create({
|
|
|
- bankName: '测试银行',
|
|
|
|
|
- bankCode: 'TESTBANK',
|
|
|
|
|
|
|
+ name: '测试银行',
|
|
|
|
|
+ code: 'TESTBANK',
|
|
|
status: 1
|
|
status: 1
|
|
|
} as any);
|
|
} as any);
|
|
|
await bankNameRepo.save(bankName);
|
|
await bankNameRepo.save(bankName);
|
|
@@ -294,7 +303,8 @@ describe('人才扩展API集成测试', () => {
|
|
|
|
|
|
|
|
// 调用API
|
|
// 调用API
|
|
|
const response = await client[':id']['credit-info'].$get({
|
|
const response = await client[':id']['credit-info'].$get({
|
|
|
- param: { id: testDisabledPerson.id },
|
|
|
|
|
|
|
+ param: { id: testDisabledPerson.id }
|
|
|
|
|
+ },{
|
|
|
headers: {
|
|
headers: {
|
|
|
Authorization: `Bearer ${testToken}`
|
|
Authorization: `Bearer ${testToken}`
|
|
|
}
|
|
}
|
|
@@ -348,7 +358,8 @@ describe('人才扩展API集成测试', () => {
|
|
|
|
|
|
|
|
// 调用API
|
|
// 调用API
|
|
|
const response = await client[':id'].videos.$get({
|
|
const response = await client[':id'].videos.$get({
|
|
|
- param: { id: testDisabledPerson.id },
|
|
|
|
|
|
|
+ param: { id: testDisabledPerson.id }
|
|
|
|
|
+ },{
|
|
|
headers: {
|
|
headers: {
|
|
|
Authorization: `Bearer ${testToken}`
|
|
Authorization: `Bearer ${testToken}`
|
|
|
}
|
|
}
|