From 49126d44344ee0c1d32a92be8b43afff85a1f952 Mon Sep 17 00:00:00 2001 From: yuneng Date: Tue, 22 Sep 2026 00:34:59 +0000 Subject: [PATCH] test(ui): pin the clock in the per-user export filename test Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- .../src/components/EntityUsageExport/utils.test.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ui/litellm-dashboard/src/components/EntityUsageExport/utils.test.ts b/ui/litellm-dashboard/src/components/EntityUsageExport/utils.test.ts index b8f36d57c85..3f9cf58ec20 100644 --- a/ui/litellm-dashboard/src/components/EntityUsageExport/utils.test.ts +++ b/ui/litellm-dashboard/src/components/EntityUsageExport/utils.test.ts @@ -2234,12 +2234,13 @@ describe("EntityUsageExport utils", () => { it("should generate the daily_with_users filename and include User ID in the rows", () => { const anchorElement = document.createElement("a"); vi.spyOn(document, "createElement").mockReturnValue(anchorElement); - - const today = new Date().toISOString().split("T")[0]; + vi.useFakeTimers(); + vi.setSystemTime(new Date("2025-03-01T12:00:00Z")); handleExportCSV(usersFixture, "daily_with_users", "Team", "team", mockTeamAliasMap); + vi.useRealTimers(); - expect(anchorElement.download).toBe(`team_usage_daily_with_users_${today}.csv`); + expect(anchorElement.download).toBe("team_usage_daily_with_users_2025-03-01.csv"); const unparsedRows = vi.mocked(Papa.unparse).mock.calls[0][0] as Record[]; expect(unparsedRows[0]).toHaveProperty("User ID");