diff --git a/ui/litellm-dashboard/src/components/view_logs/RequestLogsTableColumns.test.tsx b/ui/litellm-dashboard/src/components/view_logs/RequestLogsTableColumns.test.tsx index d60b9ce30f1..626d290e0e8 100644 --- a/ui/litellm-dashboard/src/components/view_logs/RequestLogsTableColumns.test.tsx +++ b/ui/litellm-dashboard/src/components/view_logs/RequestLogsTableColumns.test.tsx @@ -75,14 +75,13 @@ describe("Cost column", () => { }); it("does not label the per-call spend a session total when the aggregate is unavailable", () => { - renderRows([ - logEntry({ - request_id: "req-session-no-aggregate", - spend: 0.01, - session_id: "sess-1", - session_total_count: 3, - }), - ]); + const rowWithoutAggregate: Partial = { + request_id: "req-session-no-aggregate", + spend: 0.01, + session_id: "sess-1", + session_total_count: 3, + }; + renderRows([logEntry(rowWithoutAggregate)]); expect(screen.getByText("$0.010000")).toBeInTheDocument(); expect(screen.queryByText("session total")).not.toBeInTheDocument(); @@ -90,16 +89,16 @@ describe("Cost column", () => { }); describe("Duration column", () => { + const sessionRow: Partial = { + request_id: "req-session-duration", + request_duration_ms: 1200, + session_id: "sess-1", + session_total_count: 3, + }; + it("shows the summed session duration, not the representative call's duration, for a multi-round session", () => { - renderRows([ - logEntry({ - request_id: "req-session-duration", - request_duration_ms: 1200, - session_id: "sess-1", - session_total_count: 3, - session_total_duration_ms: 5400, - }), - ]); + const aggregatedRow: Partial = { ...sessionRow, session_total_duration_ms: 5400 }; + renderRows([logEntry(aggregatedRow)]); expect(screen.getByText("5.40")).toBeInTheDocument(); expect(screen.queryByText("1.20")).not.toBeInTheDocument(); @@ -107,29 +106,21 @@ describe("Duration column", () => { }); it("does not label the per-call duration a session total when the aggregate is unavailable", () => { - renderRows([ - logEntry({ - request_id: "req-no-aggregate", - request_duration_ms: 1200, - session_id: "sess-3", - session_total_count: 3, - }), - ]); + renderRows([logEntry(sessionRow)]); expect(screen.getByText("1.20")).toBeInTheDocument(); expect(screen.queryByText("session total")).not.toBeInTheDocument(); }); it("shows the call's own duration for a single-call session", () => { - renderRows([ - logEntry({ - request_id: "req-single-duration", - request_duration_ms: 1200, - session_id: "sess-2", - session_total_count: 1, - session_total_duration_ms: 1200, - }), - ]); + const singleCallRow: Partial = { + ...sessionRow, + request_id: "req-single-duration", + session_id: "sess-2", + session_total_count: 1, + session_total_duration_ms: 1200, + }; + renderRows([logEntry(singleCallRow)]); expect(screen.getByText("1.20")).toBeInTheDocument(); });