diff --git a/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/GuardrailsPanel.integration.test.tsx b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/GuardrailsPanel.integration.test.tsx index 973c101f545..c78348ff5a3 100644 --- a/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/GuardrailsPanel.integration.test.tsx +++ b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/GuardrailsPanel.integration.test.tsx @@ -56,6 +56,13 @@ beforeAll(() => { }); }); +const UI_SETTINGS = { + supported_entities: [], + supported_actions: [], + pii_entity_categories: [], + supported_modes: ["pre_call", "post_call"], +}; + describe("GuardrailsPanel delete from the guardrail detail Settings card", () => { beforeEach(() => { vi.clearAllMocks(); @@ -63,12 +70,7 @@ describe("GuardrailsPanel delete from the guardrail detail Settings card", () => vi.mocked(getGuardrailInfo).mockImplementation(async (_token: string, id: string) => id === CONFIG_GUARDRAIL.guardrail_id ? CONFIG_GUARDRAIL : DB_GUARDRAIL, ); - vi.mocked(getGuardrailUISettings).mockResolvedValue({ - supported_entities: [], - supported_actions: [], - pii_entity_categories: [], - supported_modes: ["pre_call", "post_call"], - }); + vi.mocked(getGuardrailUISettings).mockResolvedValue(UI_SETTINGS); vi.mocked(getGuardrailProviderSpecificParams).mockResolvedValue({}); }); diff --git a/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/guardrail_info.test.tsx b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/guardrail_info.test.tsx index 14c6dfa9c11..f1fd7c744ae 100644 --- a/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/guardrail_info.test.tsx +++ b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/guardrail_info.test.tsx @@ -384,19 +384,21 @@ describe("Guardrail Info when the guardrail cannot be loaded", () => { }); describe("Delete from the Settings card", () => { + const dbGuardrail = { + guardrail_id: "123", + guardrail_name: "Test Guardrail", + litellm_params: { guardrail: "presidio", mode: "pre_call", default_on: true }, + guardrail_definition_location: "db", + }; + const uiSettings = { + supported_entities: [], + supported_actions: [], + pii_entity_categories: [], + supported_modes: ["pre_call"], + }; const mockDbGuardrail = () => { - vi.mocked(networking.getGuardrailInfo).mockResolvedValue({ - guardrail_id: "123", - guardrail_name: "Test Guardrail", - litellm_params: { guardrail: "presidio", mode: "pre_call", default_on: true }, - guardrail_definition_location: "db", - }); - vi.mocked(networking.getGuardrailUISettings).mockResolvedValue({ - supported_entities: [], - supported_actions: [], - pii_entity_categories: [], - supported_modes: ["pre_call"], - }); + vi.mocked(networking.getGuardrailInfo).mockResolvedValue(dbGuardrail); + vi.mocked(networking.getGuardrailUISettings).mockResolvedValue(uiSettings); vi.mocked(networking.getGuardrailProviderSpecificParams).mockResolvedValue({}); };