修正CEO报销财务兜底与部署护栏(07-28-ceo-finance-fallback)
这个提交包含在:
@@ -164,6 +164,28 @@ describe("workflow assignee resolution", () => {
|
||||
expect(resolved.actionable.assigneeRole).toBe("finance_mgr");
|
||||
});
|
||||
|
||||
it.each([
|
||||
["small", { level1_role: "manager", level2_role: "finance", level3_role: null }],
|
||||
["medium", { level1_role: "manager", level2_role: "finance", level3_role: null }],
|
||||
["large", { level1_role: "manager", level2_role: "ceo", level3_role: "finance" }],
|
||||
])("uses one finance fallback node for CEO owner %s rules", async (_name, rule) => {
|
||||
const tx = buildTx({ ownerRoles: ["ceo"], managerId: null });
|
||||
|
||||
const steps = await workflowUtils.buildApprovalWorkflowSnapshot({
|
||||
tx,
|
||||
ownerId: OWNER_ID,
|
||||
approvalRule: {
|
||||
...rule,
|
||||
owner_self_fallback_role: "finance",
|
||||
},
|
||||
});
|
||||
|
||||
expect(steps.map((step) => step.assignee_rule)).toEqual([
|
||||
{ type: "role", value: "finance" },
|
||||
]);
|
||||
expect(steps[0].id).toContain("owner_self_fallback");
|
||||
});
|
||||
|
||||
it("removes CEO self node and duplicate fallback role for large CEO owner applications", async () => {
|
||||
const tx = buildTx({ ownerRoles: ["ceo"], managerId: null });
|
||||
|
||||
@@ -225,7 +247,7 @@ describe("workflow assignee resolution", () => {
|
||||
ownerId: OWNER_ID,
|
||||
approvalRule: {
|
||||
level1_role: "manager",
|
||||
owner_self_fallback_role: "finance_mgr",
|
||||
owner_self_fallback_role: "finance",
|
||||
},
|
||||
}),
|
||||
).rejects.toMatchObject({
|
||||
@@ -238,7 +260,7 @@ describe("workflow assignee resolution", () => {
|
||||
|
||||
it("blocks fallback when the owner also holds the fallback role", async () => {
|
||||
const tx = buildTx({
|
||||
ownerRoles: ["ceo", "finance_mgr"],
|
||||
ownerRoles: ["ceo", "finance"],
|
||||
managerId: null,
|
||||
});
|
||||
|
||||
@@ -248,7 +270,7 @@ describe("workflow assignee resolution", () => {
|
||||
ownerId: OWNER_ID,
|
||||
approvalRule: {
|
||||
level1_role: "manager",
|
||||
owner_self_fallback_role: "finance_mgr",
|
||||
owner_self_fallback_role: "finance",
|
||||
},
|
||||
}),
|
||||
).rejects.toMatchObject({
|
||||
|
||||
在新工单中引用
屏蔽一个用户