mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-06 02:48:13 +00:00
chore(ui): avoid inline guardrail test fixtures
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
parent
e755b9a994
commit
089608554d
1 changed files with 15 additions and 21 deletions
|
|
@ -165,24 +165,19 @@ describe("GuardrailInfoView update payload characterization", () => {
|
|||
});
|
||||
|
||||
it("shows and updates the logging-only scope", async () => {
|
||||
vi.mocked(networking.getGuardrailInfo).mockResolvedValue(
|
||||
guardrail({
|
||||
guardrailIdentifier: "gr-abc",
|
||||
api_key: "sk-old",
|
||||
mode: "logging_only",
|
||||
logging_only_scope: "input",
|
||||
}),
|
||||
);
|
||||
const guardrailParams = {
|
||||
guardrailIdentifier: "gr-abc",
|
||||
api_key: "sk-old",
|
||||
mode: "logging_only",
|
||||
logging_only_scope: "input",
|
||||
};
|
||||
vi.mocked(networking.getGuardrailInfo).mockResolvedValue(guardrail(guardrailParams));
|
||||
const user = userEvent.setup({ delay: null });
|
||||
renderView();
|
||||
|
||||
expect(await screen.findAllByText("Input only (request)")).toHaveLength(2);
|
||||
await openEditor(user);
|
||||
await chooseSelectOption(
|
||||
user,
|
||||
screen.getByLabelText("Logging only scope"),
|
||||
"Output only (response)",
|
||||
);
|
||||
await chooseSelectOption(user, screen.getByLabelText("Logging only scope"), "Output only (response)");
|
||||
await saveChanges(user);
|
||||
|
||||
await waitFor(() => expect(networking.updateGuardrailCall).toHaveBeenCalledTimes(1));
|
||||
|
|
@ -190,14 +185,13 @@ describe("GuardrailInfoView update payload characterization", () => {
|
|||
});
|
||||
|
||||
it("clears the logging-only scope when the edit choice returns to default", async () => {
|
||||
vi.mocked(networking.getGuardrailInfo).mockResolvedValue(
|
||||
guardrail({
|
||||
guardrailIdentifier: "gr-abc",
|
||||
api_key: "sk-old",
|
||||
mode: "logging_only",
|
||||
logging_only_scope: "input",
|
||||
}),
|
||||
);
|
||||
const guardrailParams = {
|
||||
guardrailIdentifier: "gr-abc",
|
||||
api_key: "sk-old",
|
||||
mode: "logging_only",
|
||||
logging_only_scope: "input",
|
||||
};
|
||||
vi.mocked(networking.getGuardrailInfo).mockResolvedValue(guardrail(guardrailParams));
|
||||
const user = userEvent.setup({ delay: null });
|
||||
renderView();
|
||||
await openEditor(user);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue