From a96517ccb5c2bbe0139185b16e2ea9e0c57aaa1a Mon Sep 17 00:00:00 2001 From: majdyz Date: Wed, 15 Apr 2026 19:45:36 +0700 Subject: [PATCH] test(frontend): cover graph_exec_id filter apply path in PlatformCostContent --- .../__tests__/PlatformCostContent.test.tsx | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/autogpt_platform/frontend/src/app/(platform)/admin/platform-costs/__tests__/PlatformCostContent.test.tsx b/autogpt_platform/frontend/src/app/(platform)/admin/platform-costs/__tests__/PlatformCostContent.test.tsx index ef61aed5ce..2b3845f53c 100644 --- a/autogpt_platform/frontend/src/app/(platform)/admin/platform-costs/__tests__/PlatformCostContent.test.tsx +++ b/autogpt_platform/frontend/src/app/(platform)/admin/platform-costs/__tests__/PlatformCostContent.test.tsx @@ -399,6 +399,26 @@ describe("PlatformCostContent", () => { expect(input.value).toBe(""); }); + it("passes execution ID to filter on Apply click", async () => { + mockUseGetDashboard.mockReturnValue({ + data: emptyDashboard, + isLoading: false, + }); + mockUseGetLogs.mockReturnValue({ data: emptyLogs, isLoading: false }); + renderComponent(); + await waitFor(() => + expect(document.querySelector(".animate-pulse")).toBeNull(), + ); + const input = screen.getByPlaceholderText( + "Filter by execution", + ) as HTMLInputElement; + fireEvent.change(input, { target: { value: "exec-abc" } }); + expect(input.value).toBe("exec-abc"); + fireEvent.click(screen.getByText("Apply")); + // After apply, the input still holds the typed value + expect(input.value).toBe("exec-abc"); + }); + it("renders by-user tab when specified", async () => { mockUseGetDashboard.mockReturnValue({ data: dashboardWithData,