mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-05 02:41:56 +00:00
chore(ui): repair failing vitest tests after shadcn migration (batch B)
Co-authored-by: yuneng-jiang <yuneng-berri@users.noreply.github.com>
This commit is contained in:
parent
c84b7614e3
commit
10f6cad106
4 changed files with 16 additions and 11 deletions
|
|
@ -214,7 +214,7 @@ describe("FallbackSelectionForm", () => {
|
|||
);
|
||||
expect(screen.getByRole("tab", { name: "gpt-4" })).toBeInTheDocument();
|
||||
expect(screen.getAllByText("gpt-4").length).toBeGreaterThan(0);
|
||||
expect(screen.getByText("gpt-3.5-turbo")).toBeInTheDocument();
|
||||
expect(screen.getAllByText("gpt-3.5-turbo").length).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
it("should not add group when add button clicked at maxGroups", () => {
|
||||
|
|
|
|||
|
|
@ -171,7 +171,8 @@ describe("TeamSSOSettings", () => {
|
|||
|
||||
renderWithProviders(<TeamSSOSettings {...defaultProps} />);
|
||||
|
||||
expect(screen.getByTestId("spinner")).toBeInTheDocument();
|
||||
// Loading state renders a shadcn Skeleton (div with animate-pulse).
|
||||
expect(document.querySelector(".animate-pulse")).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("should display error message when fetch fails", async () => {
|
||||
|
|
@ -377,8 +378,9 @@ describe("TeamSSOSettings", () => {
|
|||
await userEvent.click(screen.getByRole("button", { name: /Edit Settings/i }));
|
||||
|
||||
await waitFor(() => {
|
||||
const numberInputs = screen.getAllByLabelText("number input");
|
||||
// max_budget, tpm_limit, rpm_limit
|
||||
// Edit mode renders 3 number <input type="number"> fields for
|
||||
// max_budget, tpm_limit, rpm_limit (rendered as shadcn Inputs).
|
||||
const numberInputs = document.querySelectorAll('input[type="number"]');
|
||||
expect(numberInputs.length).toBe(3);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -29,8 +29,8 @@ describe("AdvancedDatePicker", () => {
|
|||
});
|
||||
|
||||
const openDropdown = (container: HTMLElement) => {
|
||||
// Find the clickable div that contains the clock icon
|
||||
const trigger = container.querySelector('[role="img"][aria-label="clock-circle"]')?.closest("div.cursor-pointer");
|
||||
// Find the clickable div that contains the lucide Clock icon.
|
||||
const trigger = container.querySelector(".lucide-clock")?.closest("div.cursor-pointer");
|
||||
if (trigger) {
|
||||
fireEvent.click(trigger);
|
||||
}
|
||||
|
|
@ -47,10 +47,10 @@ describe("AdvancedDatePicker", () => {
|
|||
});
|
||||
|
||||
it("should display formatted date range", () => {
|
||||
render(<AdvancedDatePicker value={defaultValue} onValueChange={mockOnValueChange} />);
|
||||
const { container } = render(<AdvancedDatePicker value={defaultValue} onValueChange={mockOnValueChange} />);
|
||||
// The component displays date range in the format "D MMM, HH:mm - D MMM, HH:mm"
|
||||
// Just check that the clock icon is present
|
||||
expect(screen.getByLabelText("clock-circle")).toBeInTheDocument();
|
||||
// Just check that the (lucide) clock icon is present in the trigger.
|
||||
expect(container.querySelector(".lucide-clock")).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("should open dropdown when clicked", () => {
|
||||
|
|
|
|||
|
|
@ -624,8 +624,11 @@ describe("KeyEditView", () => {
|
|||
});
|
||||
|
||||
const orgFormItem = screen.getByText("Organization").closest(".ant-form-item");
|
||||
const disabledSelect = orgFormItem?.querySelector(".ant-select-disabled");
|
||||
expect(disabledSelect).toBeTruthy();
|
||||
// OrganizationDropdown now renders a shadcn Select trigger
|
||||
// (role="combobox") that gets the disabled attribute from Radix.
|
||||
const orgCombobox = orgFormItem?.querySelector('[role="combobox"]') as HTMLButtonElement | null;
|
||||
expect(orgCombobox).toBeTruthy();
|
||||
expect(orgCombobox).toBeDisabled();
|
||||
});
|
||||
|
||||
it("should not disable the organization dropdown for admin users", async () => {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue