mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-08 22:21:35 +00:00
Address greptile review feedback (greploop iteration 3)
- Add tests for getTestSourceOptions (2 tests) - Add null guards to selectAntOption test helper Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
23a9a4190b
commit
abccac89dc
2 changed files with 27 additions and 2 deletions
|
|
@ -95,12 +95,14 @@ const defaultProps = {
|
|||
};
|
||||
|
||||
async function selectAntOption(user: ReturnType<typeof userEvent.setup>, title: string) {
|
||||
const selector = document.querySelector(".ant-select-selector") as HTMLElement;
|
||||
const selector = document.querySelector(".ant-select-selector");
|
||||
if (!selector) throw new Error("Ant Select selector not found");
|
||||
await user.click(selector);
|
||||
await waitFor(() => {
|
||||
expect(document.querySelector(`[title="${title}"].ant-select-item-option`)).toBeInTheDocument();
|
||||
});
|
||||
const option = document.querySelector(`[title="${title}"].ant-select-item-option`) as HTMLElement;
|
||||
const option = document.querySelector(`[title="${title}"].ant-select-item-option`);
|
||||
if (!option) throw new Error(`Ant Select option "${title}" not found`);
|
||||
await user.click(option);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import {
|
|||
derivePipelineFromPolicy,
|
||||
complianceMatchExpected,
|
||||
getPromptsForTestSource,
|
||||
getTestSourceOptions,
|
||||
TEST_SOURCE_QUICK,
|
||||
TEST_SOURCE_ALL,
|
||||
} from "./pipeline_utils";
|
||||
|
|
@ -219,3 +220,25 @@ describe("getPromptsForTestSource", () => {
|
|||
vi.restoreAllMocks();
|
||||
});
|
||||
});
|
||||
|
||||
describe("getTestSourceOptions", () => {
|
||||
it("should always include quick chat and all datasets options", () => {
|
||||
vi.spyOn(complianceData, "getFrameworks").mockReturnValue([]);
|
||||
const options = getTestSourceOptions();
|
||||
expect(options[0]).toEqual({ value: TEST_SOURCE_QUICK, label: "Quick chat (custom message)" });
|
||||
expect(options[options.length - 1]).toEqual({ value: TEST_SOURCE_ALL, label: "All compliance datasets" });
|
||||
vi.restoreAllMocks();
|
||||
});
|
||||
|
||||
it("should include framework names from getFrameworks", () => {
|
||||
vi.spyOn(complianceData, "getFrameworks").mockReturnValue([
|
||||
{ name: "GDPR", icon: "", description: "", categories: [] },
|
||||
{ name: "EU AI Act", icon: "", description: "", categories: [] },
|
||||
]);
|
||||
const options = getTestSourceOptions();
|
||||
expect(options).toHaveLength(4);
|
||||
expect(options[1]).toEqual({ value: "GDPR", label: "GDPR" });
|
||||
expect(options[2]).toEqual({ value: "EU AI Act", label: "EU AI Act" });
|
||||
vi.restoreAllMocks();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue