# 组织架构模块 - 单元测试报告

- 测试范围: organization 模块单元测试（Jest）
- 测试类型: 单元测试
- 环境信息: 本地开发环境
- 版本/分支: develop（本地变更）
- 执行时间: 2026-01-21
- 执行命令: `cd testing && npm run test:backend:unit`

## 用例明细（失败）

| 用例ID | 前置条件 | 输入 | 使用的 API/函数 | 输出 | 结果 | 断言点 |
| --- | --- | --- | --- | --- | --- | --- |
| PositionsService.create | 岗位代码重复 | 创建岗位 | PositionsService.create | 409/400 | 失败 | 期望 BadRequestException，实际 ConflictException |
| PositionsService.remove | 岗位有关联用户 | 删除岗位 | PositionsService.remove | 400 | 失败 | 期望英文提示，实际中文提示 |
| AuthService.login | 正常登录 | 登录 | AuthService.login | token | 失败 | result.token 为 undefined |
| AuthService.register | 用户名已存在 | 注册 | AuthService.register | 401 | 失败 | 期望 UnauthorizedException，实际 ConflictException |
| OrganizationsService.create | 组织名重复 | 创建组织 | OrganizationsService.create | 409 | 失败 | 期望 ConflictException，实际 IamOrganizationNameExistsException |
| UsersService.getUserPermissions | 用户无角色 | 获取权限 | UsersService.getUserPermissions | 空权限 | 失败 | 返回多了 organizationId: null |

## 失败信息

- jest-haste-map: outline 包名冲突（apps/outline/package.json 与 apps/outline/build/package.json）
- 失败用例: 9 个（详见终端输出）

## 资产引用

- 无

## 覆盖度说明

- 本次执行为全量后端单元测试
- 通过: 199
- 失败: 9

## 契约一致性

- 与本次 devtracker 变更无直接关联（失败集中于 organization 模块）

## 流程说明

- 流程摘要: 运行后端单元测试
- 结果摘要: 失败（需用户确认是否修复或忽略这些既有失败）
