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:
jesus 2026-10-11 00:02:57 +00:00
parent c651ebcbee
commit bb7abc0eb5
2 changed files with 22 additions and 18 deletions

View file

@ -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({});
});

View file

@ -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({});
};