test: cover null resource envelopes for account pages (#70) (#71) #78

Merged
codex-bot merged 1 commits from test/70-71-null-resource-regression into develop 2026-10-13 22:53:28 +03:00
2 changed files with 32 additions and 0 deletions
Showing only changes of commit f2f81b6e08 - Show all commits
@@ -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 () => {
@@ -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(<AccountPageLoaded {...loadedProps()} />);