添加后端集成测试套件

- 实现 82 个集成测试用例覆盖所有 API 端点
- 使用真实数据库连接,无 mock 逻辑
- 修复 PUT 请求只更新提供字段的逻辑
- 配置 Vitest 串行执行避免测试竞态

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
hughhuangandClaude Sonnet 4.5 committed 2026-02-05 15:23:37 +08:00
1 parent 6df528f187
commit 697430feed
18 files changed
+4333 -8

No files matched your search

+8 -1
View File
@@ -70,9 +70,16 @@ export async function channelRoutes(app: FastifyInstance): Promise<void> {
throw new NotFoundError('推送渠道不存在');
}
// 构建更新数据对象,只包含提供的字段
const updateData: any = {};
if (name !== undefined) updateData.name = name;
if (type !== undefined) updateData.type = type;
if (config !== undefined) updateData.config = config;
if (enabled !== undefined) updateData.enabled = enabled;
const channel = await prisma.channel.update({
where: { id: parseInt(id) },
data: { name, type, config, enabled },
data: updateData,
});
successResponse(reply, channel, '推送渠道更新成功');