From 547c5397caa7a385de3288359a77b0580c94b48a Mon Sep 17 00:00:00 2001 From: spions Date: Fri, 7 Aug 2026 17:28:14 +0300 Subject: [PATCH] test(ui): clear localStorage between UsagePageView test cases UsagePageView now persists the selected usage view, activity tab, and date range to localStorage. Without resetting it in beforeEach, state written by one test (switching to "tag" view, a different tab, etc.) leaked into every test that ran after it in the same file, since vitest doesn't reset localStorage between tests automatically. --- .../usage/_components/components/UsagePageView.test.tsx | 4 ++++ 1 file changed, 4 insertions(+) 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 0ded7d195d0..fe6af2a2e71 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 @@ -539,6 +539,10 @@ describe("UsagePage", () => { }; beforeEach(() => { + // UsagePageView now persists the selected view/tab/date-range to + // localStorage; without clearing it here, whichever test runs first + // pollutes every test after it in this file. + localStorage.clear(); mockUseAuthorized.mockReturnValue({ isLoading: false, isAuthorized: true,