From c875836ed533f5acc781cb0ebc870ce50828ef34 Mon Sep 17 00:00:00 2001 From: zhengxinliang Date: Mon, 5 Oct 2026 20:20:05 +0800 Subject: [PATCH] test(logs): reject stale cursor on alias navigation --- .../logs/request/RequestLogsPanel.test.tsx | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/ui/litellm-dashboard/src/components/logs/request/RequestLogsPanel.test.tsx b/ui/litellm-dashboard/src/components/logs/request/RequestLogsPanel.test.tsx index 55f119baadd..6c97bf91b26 100644 --- a/ui/litellm-dashboard/src/components/logs/request/RequestLogsPanel.test.tsx +++ b/ui/litellm-dashboard/src/components/logs/request/RequestLogsPanel.test.tsx @@ -363,13 +363,19 @@ describe("RequestLogsPanel", () => { fireEvent.click(screen.getByTestId("pagination-next")); await waitFor(() => expect(lastCall()?.page).toBe(2)); + const callCountBeforeAliasNavigation = vi.mocked(uiSpendLogsCall).mock.calls.length; view.rerender(tree("exclude_key_alias=noisy")); await waitFor(() => { - const call = lastCall(); - expect(call?.page).toBe(1); - expect(call?.params?.exclude_key_alias).toBe("noisy"); - expect(call?.params?.session_cursor).toBeUndefined(); + const aliasCalls = vi + .mocked(uiSpendLogsCall) + .mock.calls.slice(callCountBeforeAliasNavigation) + .map(([options]) => options) + .filter((options) => options.params?.exclude_key_alias === "noisy"); + expect(aliasCalls.length).toBeGreaterThan(0); + expect(aliasCalls.every((options) => options.page === 1 && options.params?.session_cursor === undefined)).toBe( + true, + ); }); });