From 22d99e23e46737ceb1eee99717cd6bf2d16c4e2d Mon Sep 17 00:00:00 2001 From: Trevor Mack Date: Wed, 16 Sep 2026 16:14:01 -0400 Subject: [PATCH] test(ui): avoid adding testing-library/no-node-access in wiring test The new UsagePageView wiring test selected the user-filter combobox by walking the DOM, adding testing-library/no-node-access warnings that pushed the repo-wide count past its eslint-budgets.json ceiling and failed the "Check lint budgets" step of frontend-lint. Target the combobox by its placeholder text (a Testing Library query) instead, so the test adds no node access. --- .../components/UsagePageView.test.tsx | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/ui/litellm-dashboard/src/app/(dashboard)/usage/_components/components/UsagePageView.test.tsx b/ui/litellm-dashboard/src/app/(dashboard)/usage/_components/components/UsagePageView.test.tsx index 888717bb847..50bfd53a27b 100644 --- a/ui/litellm-dashboard/src/app/(dashboard)/usage/_components/components/UsagePageView.test.tsx +++ b/ui/litellm-dashboard/src/app/(dashboard)/usage/_components/components/UsagePageView.test.tsx @@ -1371,12 +1371,10 @@ describe("UsagePage", () => { }); describe("selected-user budget wiring", () => { - const userSelectCombobox = (): HTMLElement => { - let node: HTMLElement | null = screen.getByText("Filter by user"); - while (node && !node.querySelector('[role="combobox"]')) { - node = node.parentElement; - } - return node!.querySelector('[role="combobox"]') as HTMLElement; + const selectAlice = async () => { + const user = userEvent.setup(); + await user.click(screen.getByPlaceholderText("Search users by email…")); + await user.click(await screen.findByText("Alice (user-001)")); }; it("feeds the tile the selected user's budget and duration, not the admin's", async () => { @@ -1394,8 +1392,7 @@ describe("UsagePage", () => { renderWithProviders(); await waitFor(() => expect(mockUserDailyActivityAggregatedCall).toHaveBeenCalled()); - await userEvent.setup().click(userSelectCombobox()); - await userEvent.setup().click(screen.getByText("Alice (user-001)")); + await selectAlice(); await waitFor(() => { expect(screen.getByTestId("view-user-spend")).toHaveAttribute("data-max-budget", "600"); @@ -1415,8 +1412,7 @@ describe("UsagePage", () => { renderWithProviders(); await waitFor(() => expect(mockUserDailyActivityAggregatedCall).toHaveBeenCalled()); - await userEvent.setup().click(userSelectCombobox()); - await userEvent.setup().click(screen.getByText("Alice (user-001)")); + await selectAlice(); await waitFor(() => { expect(screen.getByTestId("view-user-spend")).toHaveAttribute("data-budget-loading", "true");