1 Commits
Author SHA1 Message Date
ksv741 f2f81b6e08 test: cover null resource envelopes for account pages (#70) (#71)
Frontend verify / commits (pull_request) Successful in 41s
Frontend verify / security (pull_request) Successful in 10s
Frontend verify / verify (pull_request) Successful in 6m20s
2026-10-13 22:43:35 +03:00
2 changed files with 32 additions and 0 deletions
@@ -492,6 +492,20 @@ describe("AccountOperationsPage", () => {
}), }),
).toBeInTheDocument(); ).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 () => { it("keeps UTC operation boundaries in GET and source sync requests", async () => {
@@ -402,6 +402,24 @@ describe("AccountPage states", () => {
).toBeInTheDocument(); ).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", () => { it("renders a stale portfolio in upstream order with nullable values hidden", () => {
renderPage(<AccountPageLoaded {...loadedProps()} />); renderPage(<AccountPageLoaded {...loadedProps()} />);