From f7f53ff8e4de3c1d06fac6063974ff9667145ed6 Mon Sep 17 00:00:00 2001 From: codex-bot Date: Tue, 13 Oct 2026 22:53:28 +0300 Subject: [PATCH] test: cover null resource envelopes for account pages (#70) (#71) (#78) --- .../AccountOperationsPage.test.tsx | 14 ++++++++++++++ .../ui/AccountPage/AccountPage.test.tsx | 18 ++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/src/pages/account-operations/ui/AccountOperationsPage/AccountOperationsPage.test.tsx b/src/pages/account-operations/ui/AccountOperationsPage/AccountOperationsPage.test.tsx index bf09049..968c1b9 100644 --- a/src/pages/account-operations/ui/AccountOperationsPage/AccountOperationsPage.test.tsx +++ b/src/pages/account-operations/ui/AccountOperationsPage/AccountOperationsPage.test.tsx @@ -492,6 +492,20 @@ describe("AccountOperationsPage", () => { }), ).toBeInTheDocument(); }); + + it("keeps a null operations envelope loading instead of a confirmed empty period", async () => { + configureTestAuth(); + server.use( + http.get("*/api/v1/brokerage-accounts/:accountId/operations", () => + HttpResponse.json(resource(null)), + ), + ); + renderPage(); + expect( + await screen.findByRole("status", { name: "Загрузка" }, { timeout: 4000 }), + ).toBeVisible(); + expect(screen.queryByText("Операций нет")).not.toBeInTheDocument(); + }); }); it("keeps UTC operation boundaries in GET and source sync requests", async () => { diff --git a/src/pages/account/ui/AccountPage/AccountPage.test.tsx b/src/pages/account/ui/AccountPage/AccountPage.test.tsx index 8b180e0..ae2c30c 100644 --- a/src/pages/account/ui/AccountPage/AccountPage.test.tsx +++ b/src/pages/account/ui/AccountPage/AccountPage.test.tsx @@ -402,6 +402,24 @@ describe("AccountPage states", () => { ).toBeInTheDocument(); }); + it("keeps a null portfolio envelope loading instead of an empty portfolio", async () => { + server.use( + http.get("*/api/v1/brokerage-accounts/:accountId/portfolio", () => + HttpResponse.json(resource(null)), + ), + ); + const queryClient = createTestQueryClient(); + renderAccountRoute(queryClient); + + expect( + await screen.findByRole("status", { name: "Загрузка" }, { timeout: 4000 }), + ).toBeVisible(); + expect(screen.queryByText("Портфель пока пуст")).not.toBeInTheDocument(); + expect( + queryClient.getQueryData(portfolioQueryOptions("account-1").queryKey), + ).toMatchObject({ data: null }); + }); + it("renders a stale portfolio in upstream order with nullable values hidden", () => { renderPage();