The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
adding tests
yuneng-jiang3ba9b13390c9
diff --git a/ui/litellm-dashboard/src/components/Settings/RouterSettings/Fallbacks/AddFallbacks.test.tsx b/ui/litellm-dashboard/src/components/Settings/RouterSettings/Fallbacks/AddFallbacks.test.tsxnew file mode 100644index 00000000000..0e05c141570--- /dev/null+++ b/ui/litellm-dashboard/src/components/Settings/RouterSettings/Fallbacks/AddFallbacks.test.tsx@@ -0,0 +1,309 @@+import { render, screen, waitFor } from "@testing-library/react";+import userEvent from "@testing-library/user-event";+import { beforeEach, describe, expect, it, vi } from "vitest";+import AddFallbacks, { Fallbacks } from "./AddFallbacks";+import * as fetchModelsModule from "../../../playground/llm_calls/fetch_models";++vi.mock("../../../playground/llm_calls/fetch_models", () => ({+ fetchAvailableModels: vi.fn(),+}));++vi.mock("antd", async (importOriginal) => {+ const actual = await importOriginal<typeof import("antd")>();+ return {+ ...actual,+ message: {+ error: vi.fn(),+ },+ };+});++vi.mock("./FallbackSelectionForm", () => ({+ FallbackSelectionForm: ({ groups, onGroupsChange }: any) => {+ const handleUpdateGroup = () => {+ if (groups.length > 0) {+ const updatedGroups = groups.map((group: any, index: number) => {+ if (index === 0 && !group.primaryModel) {+ return {+ ...group,+ primaryModel: "gpt-4",+ fallbackModels: ["gpt-3.5-turbo"],+ };+ }+ return group;+ });+ onGroupsChange(updatedGroups);+ }+ };++ return (+ <div data-testid="fallback-selection-form">+ <button onClick={handleUpdateGroup} data-testid="update-group-button">+ Update Group+ </button>+ <div data-testid="groups-count">{groups.length}</div>+ {groups.map((group: any) => (+ <div key={group.id} data-testid={`group-${group.id}`}>+ Primary: {group.primaryModel || "None"}, Fallbacks: {group.fallbackModels.length}+ </div>+ ))}+ </div>+ );+ },+}));++describe("AddFallbacks", () => {+ const mockOnChange = vi.fn();+ const mockAccessToken = "test-token";+ const mockModelGroups = [+ { model_group: "gpt-4", mode: "chat" },+ { model_group: "gpt-3.5-turbo", mode: "chat" },+ { model_group: "claude-3-opus", mode: "chat" },+ ];++ const defaultProps = {+ accessToken: mockAccessToken,+ value: [] as Fallbacks,+ onChange: mockOnChange,+ };++ beforeEach(() => {+ vi.clearAllMocks();+ vi.mocked(fetchModelsModule.fetchAvailableModels).mockResolvedValue(mockModelGroups);+ });++ it("should render the component", () => {+ render(<AddFallbacks {...defaultProps} />);+ expect(screen.getByRole("button", { name: /add fallbacks/i })).toBeInTheDocument();+ });++ it("should open modal when Add Fallbacks button is clicked", async () => {+ const user = userEvent.setup();+ render(<AddFallbacks {...defaultProps} />);++ const addButton = screen.getByRole("button", { name: /add fallbacks/i });+ await user.click(addButton);++ await waitFor(() => {+ expect(screen.getByRole("dialog")).toBeInTheDocument();+ });+ });++ it("should fetch available models when modal opens", async () => {+ const user = userEvent.setup();+ render(<AddFallbacks {...defaultProps} />);++ const addButton = screen.getByRole("button", { name: /add fallbacks/i });+ await user.click(addButton);++ await waitFor(() => {+ expect(fetchModelsModule.fetchAvailableModels).toHaveBeenCalledWith(mockAccessToken);+ });+ });++ it("should close modal when Cancel button is clicked", async () => {+ const user = userEvent.setup();+ render(<AddFallbacks {...defaultProps} />);++ const addButton = screen.getByRole("button", { name: /add fallbacks/i });+ await user.click(addButton);++ await waitFor(() => {+ expect(screen.getByRole("dialog")).toBeInTheDocument();+ });++ const cancelButton = screen.getByRole("button", { name: /cancel/i });+ await user.click(cancelButton);++ await waitFor(() => {+ expect(screen.queryByRole("dialog")).not.toBeInTheDocument();+ });+ });++ it("should show error when saving incomplete groups", async () => {+ const user = userEvent.setup();+ const antd = await import("antd");+ render(<AddFallbacks {...defaultProps} />);++ const addButton = screen.getByRole("button", { name: /add fallbacks/i });+ await user.click(addButton);++ await waitFor(() => {+ expect(screen.getByRole("dialog")).toBeInTheDocument();+ });++ await waitFor(() => {+ const saveButton = screen.getByRole("button", { name: /save all configurations/i });+ expect(saveButton).toBeInTheDocument();+ });++ const saveButton = screen.getByRole("button", { name: /save all configurations/i });+ await user.click(saveButton);++ await waitFor(() => {+ expect(antd.message.error).toHaveBeenCalled();+ });+ });++ it("should show error message when saving incomplete groups", async () => {+ const user = userEvent.setup();+ const antd = await import("antd");+ render(<AddFallbacks {...defaultProps} />);++ const addButton = screen.getByRole("button", { name: /add fallbacks/i });+ await user.click(addButton);++ await waitFor(() => {+ expect(screen.getByRole("dialog")).toBeInTheDocument();+ });++ const saveButton = screen.getByRole("button", { name: /save all configurations/i });+ await user.click(saveButton);++ await waitFor(() => {+ expect(antd.message.error).toHaveBeenCalled();+ });+ });++ it("should call onChange with new fallbacks when Save is clicked with valid configuration", async () => {+ const user = userEvent.setup();+ mockOnChange.mockResolvedValue(undefined);+ render(<AddFallbacks {...defaultProps} />);++ const addButton = screen.getByRole("button", { name: /add fallbacks/i });+ await user.click(addButton);++ await waitFor(() => {+ expect(screen.getByRole("dialog")).toBeInTheDocument();+ });++ await waitFor(() => {+ expect(screen.getByTestId("fallback-selection-form")).toBeInTheDocument();+ });++ const updateGroupButton = screen.getByTestId("update-group-button");+ await user.click(updateGroupButton);++ await waitFor(() => {+ expect(screen.getByText(/Primary: gpt-4/i)).toBeInTheDocument();+ });++ const saveButton = screen.getByRole("button", { name: /save all configurations/i });+ expect(saveButton).not.toBeDisabled();+ await user.click(saveButton);++ await waitFor(() => {+ expect(mockOnChange).toHaveBeenCalled();+ const callArgs = mockOnChange.mock.calls[0][0];+ expect(callArgs).toHaveLength(1);+ expect(callArgs[0]).toHaveProperty("gpt-4");+ expect(callArgs[0]["gpt-4"]).toContain("gpt-3.5-turbo");+ });+ });++ it("should append new fallbacks to existing value", async () => {+ const user = userEvent.setup();+ const existingFallbacks: Fallbacks = [{ "existing-model": ["fallback-1"] }];+ mockOnChange.mockResolvedValue(undefined);+ render(<AddFallbacks {...defaultProps} value={existingFallbacks} />);++ const addButton = screen.getByRole("button", { name: /add fallbacks/i });+ await user.click(addButton);++ await waitFor(() => {+ expect(screen.getByRole("dialog")).toBeInTheDocument();+ });++ await waitFor(() => {+ expect(screen.getByTestId("fallback-selection-form")).toBeInTheDocument();+ });++ const updateGroupButton = screen.getByTestId("update-group-button");+ await user.click(updateGroupButton);++ await waitFor(() => {+ expect(screen.getByText(/Primary: gpt-4/i)).toBeInTheDocument();+ });++ const saveButton = screen.getByRole("button", { name: /save all configurations/i });+ await user.click(saveButton);++ await waitFor(() => {+ expect(mockOnChange).toHaveBeenCalled();+ const callArgs = mockOnChange.mock.calls[0][0];+ expect(callArgs).toHaveLength(2);+ expect(callArgs[0]).toEqual({ "existing-model": ["fallback-1"] });+ expect(callArgs[1]).toHaveProperty("gpt-4");+ });+ });++ it("should reset form state when modal is closed", async () => {+ const user = userEvent.setup();+ render(<AddFallbacks {...defaultProps} />);++ const addButton = screen.getByRole("button", { name: /add fallbacks/i });+ await user.click(addButton);++ await waitFor(() => {+ expect(screen.getByRole("dialog")).toBeInTheDocument();+ });++ const cancelButton = screen.getByRole("button", { name: /cancel/i });+ await user.click(cancelButton);++ await waitFor(() => {+ expect(screen.queryByRole("dialog")).not.toBeInTheDocument();+ });++ await user.click(addButton);++ await waitFor(() => {+ expect(screen.getByRole("dialog")).toBeInTheDocument();+ expect(screen.getByTestId("fallback-selection-form")).toBeInTheDocument();+ });+ });++ it("should handle onChange error gracefully", async () => {+ const user = userEvent.setup();+ const error = new Error("Save failed");+ mockOnChange.mockRejectedValue(error);+ render(<AddFallbacks {...defaultProps} />);++ const addButton = screen.getByRole("button", { name: /add fallbacks/i });+ await user.click(addButton);++ await waitFor(() => {+ expect(screen.getByRole("dialog")).toBeInTheDocument();+ });++ await waitFor(() => {+ expect(screen.getByTestId("fallback-selection-form")).toBeInTheDocument();+ });++ const updateGroupButton = screen.getByTestId("update-group-button");+ await user.click(updateGroupButton);++ await waitFor(() => {+ expect(screen.getByText(/Primary: gpt-4/i)).toBeInTheDocument();+ });++ const saveButton = screen.getByRole("button", { name: /save all configurations/i });+ await user.click(saveButton);++ await waitFor(() => {+ expect(mockOnChange).toHaveBeenCalled();+ });+ });++ it("should not call onChange when onChange prop is not provided", async () => {+ const user = userEvent.setup();+ render(<AddFallbacks accessToken={mockAccessToken} value={[]} />);++ const addButton = screen.getByRole("button", { name: /add fallbacks/i });+ await user.click(addButton);++ await waitFor(() => {+ expect(screen.getByRole("dialog")).toBeInTheDocument();+ });+ });+});diff --git a/ui/litellm-dashboard/src/components/Settings/RouterSettings/Fallbacks/AddFallbacksModal.test.tsx b/ui/litellm-dashboard/src/components/Settings/RouterSettings/Fallbacks/AddFallbacksModal.test.tsxnew file mode 100644index 00000000000..c6be52f7c14--- /dev/null+++ b/ui/litellm-dashboard/src/components/Settings/RouterSettings/Fallbacks/AddFallbacksModal.test.tsx@@ -0,0 +1,56 @@+import { render, screen } from "@testing-library/react";+import { beforeEach, describe, expect, it, vi } from "vitest";+import { AddFallbacksModal } from "./AddFallbacksModal";++describe("AddFallbacksModal", () => {+ const mockOnCancel = vi.fn();++ beforeEach(() => {+ vi.clearAllMocks();+ });++ it("should render the modal when open is true", () => {+ render(+ <AddFallbacksModal open={true} onCancel={mockOnCancel}>+ <div>Test Content</div>+ </AddFallbacksModal>,+ );++ expect(screen.getByRole("dialog")).toBeInTheDocument();+ expect(screen.getByText("Configure Model Fallbacks")).toBeInTheDocument();+ expect(screen.getByText("Manage multiple fallback chains for different models (up to 5 groups at a time)")).toBeInTheDocument();+ expect(screen.getByText("Test Content")).toBeInTheDocument();+ });++ it("should not render the modal when open is false", () => {+ render(+ <AddFallbacksModal open={false} onCancel={mockOnCancel}>+ <div>Test Content</div>+ </AddFallbacksModal>,+ );++ expect(screen.queryByRole("dialog")).not.toBeInTheDocument();+ });++ it("should render children content when modal is open", () => {+ render(+ <AddFallbacksModal open={true} onCancel={mockOnCancel}>+ <div data-testid="child-content">Child Component</div>+ </AddFallbacksModal>,+ );++ expect(screen.getByTestId("child-content")).toBeInTheDocument();+ expect(screen.getByText("Child Component")).toBeInTheDocument();+ });++ it("should display the correct title and description", () => {+ render(+ <AddFallbacksModal open={true} onCancel={mockOnCancel}>+ <div>Content</div>+ </AddFallbacksModal>,+ );++ expect(screen.getByText("Configure Model Fallbacks")).toBeInTheDocument();+ expect(screen.getByText(/Manage multiple fallback chains/i)).toBeInTheDocument();+ });+});diff --git a/ui/litellm-dashboard/src/components/Settings/RouterSettings/Fallbacks/Fallbacks.test.tsx b/ui/litellm-dashboard/src/components/Settings/RouterSettings/Fallbacks/Fallbacks.test.tsxnew file mode 100644index 00000000000..bc6f6a4856c--- /dev/null+++ b/ui/litellm-dashboard/src/components/Settings/RouterSettings/Fallbacks/Fallbacks.test.tsx@@ -0,0 +1,372 @@+import { render, screen, waitFor } from "@testing-library/react";+import userEvent from "@testing-library/user-event";+import { beforeEach, describe, expect, it, vi } from "vitest";+import Fallbacks from "./fallbacks";+import * as networkingModule from "../../../networking";+import * as fetchModelsModule from "../../../playground/llm_calls/fetch_models";++vi.mock("../../../networking", () => ({+ getCallbacksCall: vi.fn(),+ setCallbacksCall: vi.fn(),+}));++vi.mock("../../../playground/llm_calls/fetch_models", () => ({+ fetchAvailableModels: vi.fn(),+}));++vi.mock("openai", () => ({+ default: {+ OpenAI: vi.fn().mockImplementation(() => ({+ chat: {+ completions: {+ create: vi.fn(),+ },+ },+ })),+ },+}));++vi.mock("../../../common_components/DeleteResourceModal", () => ({+ __esModule: true,+ default: ({ isOpen, onOk, onCancel, title, message, resourceInformation, confirmLoading }: any) => {+ if (!isOpen) return null;+ return (+ <div data-testid="delete-modal">+ <div>{title}</div>+ <div>{message}</div>+ {resourceInformation?.map((info: any, idx: number) => (+ <div key={idx}>+ {info.label}: {info.value}+ </div>+ ))}+ <button onClick={onCancel} disabled={confirmLoading}>+ Cancel+ </button>+ <button onClick={onOk} disabled={confirmLoading}>+ Delete+ </button>+ </div>+ );+ },+}));++vi.mock("./AddFallbacks", () => ({+ __esModule: true,+ default: ({ value, onChange }: any) => {+ const handleClick = async () => {+ if (onChange) {+ try {+ const newFallbacks = [...(value || []), { "test-model": ["test-fallback"] }];+ await onChange(newFallbacks);+ } catch (error) {+ // Error is handled by the component+ }+ }+ };+ return (+ <button onClick={handleClick} data-testid="add-fallbacks-button">+ Add Fallbacks+ </button>+ );+ },+}));++describe("Fallbacks", () => {+ const mockAccessToken = "test-token";+ const mockUserRole = "Admin";+ const mockUserID = "user-123";+ const mockModelData = {+ data: [+ { model_name: "gpt-4" },+ { model_name: "gpt-3.5-turbo" },+ { model_name: "claude-3-opus" },+ ],+ };++ const mockRouterSettings = {+ fallbacks: [+ { "gpt-4": ["gpt-3.5-turbo", "claude-3-opus"] },+ { "claude-3-opus": ["gpt-4"] },+ ],+ };++ const defaultProps = {+ accessToken: mockAccessToken,+ userRole: mockUserRole,+ userID: mockUserID,+ modelData: mockModelData,+ };++ const findDeleteButton = (container: HTMLElement) => {+ const tableRows = container.querySelectorAll("tbody tr");+ if (tableRows.length === 0) return null;+ const firstRow = tableRows[0];+ const actionCells = firstRow.querySelectorAll("td");+ const lastCell = actionCells[actionCells.length - 1];+ const buttons = lastCell.querySelectorAll("button");+ if (buttons.length >= 2) {+ return buttons[buttons.length - 1];+ }+ const clickableElements = lastCell.querySelectorAll("[class*='cursor-pointer'], button");+ return Array.from(clickableElements).find((el) =>+ el.className.includes("red") || el.className.includes("hover:text-red")+ ) || clickableElements[clickableElements.length - 1];+ };++ beforeEach(() => {+ vi.clearAllMocks();+ vi.mocked(networkingModule.getCallbacksCall).mockResolvedValue({+ router_settings: mockRouterSettings,+ });+ vi.mocked(networkingModule.setCallbacksCall).mockResolvedValue(undefined);+ vi.mocked(fetchModelsModule.fetchAvailableModels).mockResolvedValue([+ { model_group: "gpt-4", mode: "chat" },+ { model_group: "gpt-3.5-turbo", mode: "chat" },+ { model_group: "claude-3-opus", mode: "chat" },+ ]);+ });++ it("should render the component", async () => {+ render(<Fallbacks {...defaultProps} />);++ await waitFor(() => {+ expect(screen.getByTestId("add-fallbacks-button")).toBeInTheDocument();+ });+ });++ it("should not render when accessToken is null", () => {+ const { container } = render(<Fallbacks {...defaultProps} accessToken={null} />);+ expect(container.firstChild).toBeNull();+ });++ it("should fetch router settings on mount", async () => {+ render(<Fallbacks {...defaultProps} />);++ await waitFor(() => {+ expect(networkingModule.getCallbacksCall).toHaveBeenCalledWith(+ mockAccessToken,+ mockUserID,+ mockUserRole,+ );+ });+ });++ it("should display fallback entries in table", async () => {+ render(<Fallbacks {...defaultProps} />);++ await waitFor(() => {+ expect(screen.getAllByText("gpt-4").length).toBeGreaterThan(0);+ expect(screen.getByText("gpt-3.5-turbo, claude-3-opus")).toBeInTheDocument();+ expect(screen.getByText("claude-3-opus")).toBeInTheDocument();+ });+ });++ it("should open delete modal when delete icon is clicked", async () => {+ const user = userEvent.setup();+ const { container } = render(<Fallbacks {...defaultProps} />);++ await waitFor(() => {+ expect(screen.getAllByText("gpt-4").length).toBeGreaterThan(0);+ });++ const deleteButton = findDeleteButton(container);+ expect(deleteButton).not.toBeNull();++ await user.click(deleteButton as HTMLElement);++ await waitFor(() => {+ expect(screen.getByTestId("delete-modal")).toBeInTheDocument();+ expect(screen.getByText("Delete Fallback?")).toBeInTheDocument();+ });+ });++ it("should delete fallback when confirmed", async () => {+ const user = userEvent.setup();+ const { container } = render(<Fallbacks {...defaultProps} />);++ await waitFor(() => {+ expect(screen.getAllByText("gpt-4").length).toBeGreaterThan(0);+ });++ const deleteButton = findDeleteButton(container);+ expect(deleteButton).not.toBeNull();++ await user.click(deleteButton as HTMLElement);++ await waitFor(() => {+ expect(screen.getByTestId("delete-modal")).toBeInTheDocument();+ });++ const confirmButton = screen.getByRole("button", { name: /delete/i });+ await user.click(confirmButton);++ await waitFor(() => {+ expect(networkingModule.setCallbacksCall).toHaveBeenCalled();+ const callArgs = networkingModule.setCallbacksCall.mock.calls[0];+ expect(callArgs[0]).toBe(mockAccessToken);+ expect(callArgs[1].router_settings.fallbacks).toHaveLength(1);+ });+ });++ it("should close delete modal when cancel is clicked", async () => {+ const user = userEvent.setup();+ const { container } = render(<Fallbacks {...defaultProps} />);++ await waitFor(() => {+ expect(screen.getAllByText("gpt-4").length).toBeGreaterThan(0);+ });++ const deleteButton = findDeleteButton(container);+ expect(deleteButton).not.toBeNull();++ await user.click(deleteButton as HTMLElement);++ await waitFor(() => {+ expect(screen.getByTestId("delete-modal")).toBeInTheDocument();+ });++ const cancelButton = screen.getByRole("button", { name: /cancel/i });+ await user.click(cancelButton);++ await waitFor(() => {+ expect(screen.queryByTestId("delete-modal")).not.toBeInTheDocument();+ });+ });++ it("should show error notification on delete failure", async () => {+ const user = userEvent.setup();+ const error = new Error("Delete failed");+ vi.mocked(networkingModule.setCallbacksCall).mockRejectedValueOnce(error);+ const { container } = render(<Fallbacks {...defaultProps} />);++ await waitFor(() => {+ expect(screen.getAllByText("gpt-4").length).toBeGreaterThan(0);+ });++ const deleteButton = findDeleteButton(container);+ expect(deleteButton).not.toBeNull();++ await user.click(deleteButton as HTMLElement);++ await waitFor(() => {+ expect(screen.getByTestId("delete-modal")).toBeInTheDocument();+ });++ const confirmButton = screen.getByRole("button", { name: /delete/i });+ await user.click(confirmButton);++ await waitFor(() => {+ expect(networkingModule.setCallbacksCall).toHaveBeenCalled();+ });+ });++ it("should handle delete error gracefully", async () => {+ const user = userEvent.setup();+ const error = new Error("Delete failed");+ vi.mocked(networkingModule.setCallbacksCall).mockRejectedValueOnce(error);+ const { container } = render(<Fallbacks {...defaultProps} />);++ await waitFor(() => {+ expect(screen.getAllByText("gpt-4").length).toBeGreaterThan(0);+ });++ const deleteButton = findDeleteButton(container);+ expect(deleteButton).not.toBeNull();++ await user.click(deleteButton as HTMLElement);++ await waitFor(() => {+ expect(screen.getByTestId("delete-modal")).toBeInTheDocument();+ });++ const confirmButton = screen.getByRole("button", { name: /delete/i });+ await user.click(confirmButton);++ await waitFor(() => {+ expect(networkingModule.setCallbacksCall).toHaveBeenCalled();+ expect(screen.queryByTestId("delete-modal")).not.toBeInTheDocument();+ });+ });++ it("should handle empty fallbacks array", async () => {+ vi.mocked(networkingModule.getCallbacksCall).mockResolvedValueOnce({+ router_settings: { fallbacks: [] },+ });+ render(<Fallbacks {...defaultProps} />);++ await waitFor(() => {+ expect(screen.getByTestId("add-fallbacks-button")).toBeInTheDocument();+ });++ expect(screen.queryByText("gpt-4")).not.toBeInTheDocument();+ });++ it("should handle router settings without fallbacks property", async () => {+ vi.mocked(networkingModule.getCallbacksCall).mockResolvedValueOnce({+ router_settings: {},+ });+ render(<Fallbacks {...defaultProps} />);++ await waitFor(() => {+ expect(screen.getByTestId("add-fallbacks-button")).toBeInTheDocument();+ });+ });++ it("should remove model_group_retry_policy from router settings", async () => {+ vi.mocked(networkingModule.getCallbacksCall).mockResolvedValueOnce({+ router_settings: {+ ...mockRouterSettings,+ model_group_retry_policy: { some: "policy" },+ },+ });+ render(<Fallbacks {...defaultProps} />);++ await waitFor(() => {+ expect(networkingModule.getCallbacksCall).toHaveBeenCalled();+ });+ });++ it("should update fallbacks when AddFallbacks onChange is called", async () => {+ const user = userEvent.setup();+ render(<Fallbacks {...defaultProps} />);++ await waitFor(() => {+ expect(screen.getByTestId("add-fallbacks-button")).toBeInTheDocument();+ });++ const addButton = screen.getByTestId("add-fallbacks-button");+ await user.click(addButton);++ await waitFor(() => {+ expect(networkingModule.setCallbacksCall).toHaveBeenCalled();+ });+ });++ it("should handle fallbacks change error and refetch", async () => {+ const user = userEvent.setup();+ const error = new Error("Update failed");+ vi.mocked(networkingModule.setCallbacksCall).mockRejectedValueOnce(error);+ vi.mocked(networkingModule.getCallbacksCall).mockResolvedValue({+ router_settings: mockRouterSettings,+ });+ render(<Fallbacks {...defaultProps} />);++ await waitFor(() => {+ expect(screen.getByTestId("add-fallbacks-button")).toBeInTheDocument();+ });++ const addButton = screen.getByTestId("add-fallbacks-button");+ await user.click(addButton);++ await waitFor(() => {+ expect(networkingModule.setCallbacksCall).toHaveBeenCalled();+ });++ await waitFor(+ () => {+ expect(networkingModule.getCallbacksCall).toHaveBeenCalledTimes(2);+ },+ { timeout: 3000 },+ );+ });+});