feat: make brokerage account list compact (#111)

This commit is contained in:
2026-10-27 05:29:11 +03:00
parent 58b4e12633
commit c24704affa
5 changed files with 165 additions and 195 deletions
@@ -23,7 +23,10 @@ describe("BrokerageAccountList", () => {
bondPositionCount: 12,
stockPositionCount: 5,
totalsByCurrency: [
{ currency: "RUB", value: "1500" },
{
currency: "RUB",
value: "123456789012345678901.995",
},
{ currency: "USD", value: "20" },
{ currency: "EUR", value: "5" },
],
@@ -33,7 +36,7 @@ describe("BrokerageAccountList", () => {
},
{
id: "account-2",
name: "Недоступный",
name: "Брокерский счет",
openedOn: null,
portfolioSummary: null,
type: "BROKERAGE",
@@ -60,24 +63,27 @@ describe("BrokerageAccountList", () => {
"/accounts/account-1",
);
expect(screen.getAllByText("Брокерский счет")).toHaveLength(3);
expect(screen.getByText(/^Открыт /)).toBeInTheDocument();
expect(screen.getByText("1 500 ₽")).toBeInTheDocument();
expect(screen.getByText("20 USD")).toBeInTheDocument();
expect(screen.getByText("123 456 789 012 345 678 902,00 ₽"))
.toBeInTheDocument();
expect(screen.getByText("20,00 USD")).toBeInTheDocument();
expect(screen.getByText("Еще 1 валюта")).toBeInTheDocument();
expect(screen.getByText("Сводка временно недоступна")).toBeInTheDocument();
expect(screen.getByText("Нет текущих сумм")).toBeInTheDocument();
expect(screen.getAllByText("Открыть счет")).toHaveLength(3);
const available = within(screen.getByRole("link", { name: /Основной/ }));
expect(available.getAllByRole("definition")[0]).toHaveTextContent("5");
expect(available.getAllByRole("definition")[1]).toHaveTextContent("12");
const unvalued = within(screen.getByRole("link", { name: /Пустой/ }));
expect(unvalued.getAllByRole("definition")[0]).toHaveTextContent("2");
expect(unvalued.getAllByRole("definition")[1]).toHaveTextContent("0");
expect(
within(screen.getByRole("link", { name: /Недоступный/ })).queryByText(
"Акции",
),
).not.toBeInTheDocument();
const duplicatedName = within(screen.getByRole("link", {
name: /Сводка временно недоступна/,
}));
expect(duplicatedName.getAllByText("Брокерский счет")).toHaveLength(1);
expect(duplicatedName.queryByText("Акции")).not.toBeInTheDocument();
});
});