mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-12 03:48:56 +00:00
test(ui): hoist guardrail delete test fixtures to stay within the inline-object lint budget
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
parent
c651ebcbee
commit
bb7abc0eb5
2 changed files with 22 additions and 18 deletions
|
|
@ -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({});
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -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({});
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue