fix(FN-4488): align policy preset tests with custom preset
Fusion-Task-Id: FN-4488 Fusion-Task-Lineage: 3fc1ac43-490f-43f2-a27e-4fdceb64d9c4
This commit is contained in:
@@ -15,6 +15,7 @@ describe("agent-permission-policy", () => {
|
||||
"unrestricted",
|
||||
"approval-required",
|
||||
"locked-down",
|
||||
"custom",
|
||||
]);
|
||||
});
|
||||
|
||||
@@ -65,6 +66,6 @@ describe("agent-permission-policy", () => {
|
||||
expect(isAgentPermissionPolicyPresetId("unrestricted")).toBe(true);
|
||||
expect(isAgentPermissionPolicyPresetId("approval-required")).toBe(true);
|
||||
expect(isAgentPermissionPolicyPresetId("locked-down")).toBe(true);
|
||||
expect(isAgentPermissionPolicyPresetId("custom")).toBe(false);
|
||||
expect(isAgentPermissionPolicyPresetId("custom")).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -126,6 +126,10 @@ function normalizeProjectDefaultPolicy(
|
||||
merged[category] = nextValue;
|
||||
}
|
||||
|
||||
if (Object.keys(merged).length === 0) {
|
||||
return normalizeAgentPermissionPolicyFromPreset(DEFAULT_AGENT_PERMISSION_POLICY_PRESET_ID);
|
||||
}
|
||||
|
||||
return normalizeAgentPermissionPolicy({
|
||||
presetId: "custom",
|
||||
rules: { ...seed, ...merged },
|
||||
|
||||
@@ -1959,7 +1959,7 @@ describe("Agent create/update routes", () => {
|
||||
JSON.stringify({
|
||||
name: "Invalid Policy Agent",
|
||||
role: "executor",
|
||||
permissionPolicy: { presetId: "custom" },
|
||||
permissionPolicy: { presetId: "not-a-preset" },
|
||||
}),
|
||||
{ "Content-Type": "application/json" },
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user