fix: 合并后清理重复测试与修复 CEO/财务兜底脚本注入 bug
- apply-ceo-finance-fallback.js: execute() 原先在传入 mock pool 时仍强制要求 DATABASE_URL 环境变量,导致单测无法注入 mock pool 验证事务逻辑。改为仅在 未传入 pool 时才检查 DATABASE_URL。 - portal.test.js: 删除本次合并前遗留的重复用例(期望旧的 portal.feature_disabled reasonCode),候选分支自带的等价用例更完整 (校验 reasonCode 以及全部零写入断言)。 - todos.test.js: 删除本次合并前遗留的文件,候选分支的 todos.errors.test.js 覆盖等价且更完整。
这个提交包含在:
@@ -573,26 +573,4 @@ describe("portal routes", () => {
|
||||
await app.close();
|
||||
});
|
||||
|
||||
it("returns a precise reasonCode and skips business queries when portal home is disabled", async () => {
|
||||
featureFlagState.portalHome = false;
|
||||
const { app, prisma } = await buildApp({});
|
||||
|
||||
const response = await app.inject({
|
||||
method: "GET",
|
||||
url: "/api/portal/home",
|
||||
headers: { authorization: "Bearer test" },
|
||||
});
|
||||
|
||||
expect(response.statusCode).toBe(409);
|
||||
expect(response.json()).toMatchObject({
|
||||
error: {
|
||||
code: "VALID_001",
|
||||
details: { featureFlag: "portal_home_v1_disabled", reason: "env_hard_off", reasonCode: "portal.feature_disabled" },
|
||||
},
|
||||
});
|
||||
expect(prisma.reimbursementForm.count).not.toHaveBeenCalled();
|
||||
expect(prisma.workflowTask.count).not.toHaveBeenCalled();
|
||||
|
||||
await app.close();
|
||||
});
|
||||
});
|
||||
|
||||
在新工单中引用
屏蔽一个用户