diff --git a/src/pages/account-events/ui/AccountEventsPage/AccountEventsPage.test.tsx b/src/pages/account-events/ui/AccountEventsPage/AccountEventsPage.test.tsx index 8deb468..8874f94 100644 --- a/src/pages/account-events/ui/AccountEventsPage/AccountEventsPage.test.tsx +++ b/src/pages/account-events/ui/AccountEventsPage/AccountEventsPage.test.tsx @@ -211,4 +211,30 @@ describe("AccountEventsPage", () => { expect(status).toHaveAttribute("aria-busy", "true"); expect(within(status).queryByRole("button")).not.toBeInTheDocument(); }); + + it("keeps a null events envelope loading instead of an empty period", () => { + query.mockReturnValue( + { + data: null, + isError: false, + isLoading: false, + meta: { + availability: "available", + completeness: "complete", + lastAttempt: { finishedAt: null, problems: [], startedAt: null, state: "none" }, + }, + refetch: vi.fn(), + } as never, + ); + + renderPage(); + + expect(screen.getByRole("status", { name: "Загрузка" })).toHaveAttribute( + "aria-busy", + "true", + ); + expect( + screen.queryByText("За выбранный период событий не найдено"), + ).not.toBeInTheDocument(); + }); }); diff --git a/src/pages/account-income/ui/AccountIncomePage/AccountIncomePage.test.tsx b/src/pages/account-income/ui/AccountIncomePage/AccountIncomePage.test.tsx index 0ae6c3e..c821122 100644 --- a/src/pages/account-income/ui/AccountIncomePage/AccountIncomePage.test.tsx +++ b/src/pages/account-income/ui/AccountIncomePage/AccountIncomePage.test.tsx @@ -314,6 +314,24 @@ describe("AccountIncomePage", () => { ).not.toBeInTheDocument(); }); + it("keeps a null analytics envelope loading instead of an empty page", async () => { + server.use( + http.get("*/api/v1/brokerage-accounts/account-1/income-analytics", () => + HttpResponse.json(resource(null)), + ), + ); + renderPage(); + expect( + await screen.findByRole("status", { name: "Загрузка" }, { timeout: 4000 }), + ).toBeVisible(); + expect( + screen.queryByRole("heading", { name: "Пассивный доход" }), + ).not.toBeInTheDocument(); + expect( + screen.queryByRole("button", { name: "Повторить" }), + ).not.toBeInTheDocument(); + }); + it("renders the signed drill-down using opaque membership rather than instrument identity", async () => { const response = { diff --git a/src/pages/account/ui/AccountPage/AccountPage.test.tsx b/src/pages/account/ui/AccountPage/AccountPage.test.tsx index ae2c30c..2ad05c9 100644 --- a/src/pages/account/ui/AccountPage/AccountPage.test.tsx +++ b/src/pages/account/ui/AccountPage/AccountPage.test.tsx @@ -420,6 +420,32 @@ describe("AccountPage states", () => { ).toMatchObject({ data: null }); }); + it("keeps null events and income envelopes loading in the previews", async () => { + server.use( + http.get("*/api/v1/brokerage-accounts/:accountId/events", () => + HttpResponse.json(resource(null)), + ), + http.get("*/api/v1/brokerage-accounts/:accountId/income-summary", () => + HttpResponse.json(resource(null)), + ), + ); + renderAccountRoute(createTestQueryClient()); + + expect( + await screen.findByText("Портфель пока пуст", undefined, { + timeout: 4000, + }), + ).toBeVisible(); + expect( + screen.getByRole("status", { name: "Загрузка будущих событий" }), + ).toBeVisible(); + expect( + screen.queryByText("На ближайшие 30 дней событий не найдено."), + ).not.toBeInTheDocument(); + expect(screen.getByText("Загрузка дохода текущего месяца")).toBeVisible(); + expect(screen.queryByText("Нет текущих сумм")).not.toBeInTheDocument(); + }); + it("renders a stale portfolio in upstream order with nullable values hidden", () => { renderPage();