test: cover null events and income envelopes on account pages (#72) #79
@@ -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();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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
|
||||
= {
|
||||
|
||||
@@ -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(<AccountPageLoaded {...loadedProps()} />);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user