|
|
@@ -7,13 +7,15 @@ import {
|
|
|
import { IntegrationTestAssertions } from '../utils/integration-test-utils';
|
|
|
import adminAreaRoutes from '../../src/api/admin/areas';
|
|
|
import { AreaEntity, AreaLevel } from '../../src/modules/areas/area.entity';
|
|
|
+import { Role, UserEntity } from '@d8d/user-module';
|
|
|
+import { File } from '@d8d/file-module';
|
|
|
import { DisabledStatus } from '@d8d/shared-types';
|
|
|
import { TestDataFactory } from '../utils/test-data-factory';
|
|
|
import { AuthService } from '@d8d/auth-module';
|
|
|
import { UserService } from '@d8d/user-module';
|
|
|
|
|
|
// 设置集成测试钩子
|
|
|
-setupIntegrationDatabaseHooksWithEntities([AreaEntity])
|
|
|
+setupIntegrationDatabaseHooksWithEntities([AreaEntity, UserEntity, File, Role])
|
|
|
|
|
|
describe('管理地区API集成测试 (使用hono/testing)', () => {
|
|
|
let client: ReturnType<typeof testClient<typeof adminAreaRoutes>>;
|
|
|
@@ -348,8 +350,9 @@ describe('管理地区API集成测试 (使用hono/testing)', () => {
|
|
|
|
|
|
// 验证子树包含城市
|
|
|
const subTree = responseData.data;
|
|
|
+ expect(subTree).toBeDefined();
|
|
|
expect(subTree).toHaveProperty('children');
|
|
|
- if (subTree.children) {
|
|
|
+ if (subTree && subTree.children) {
|
|
|
const cityNames = subTree.children.map((city: any) => city.name);
|
|
|
expect(cityNames).toContain('朝阳区');
|
|
|
expect(cityNames).toContain('海淀区');
|