feat: redesign portfolio position cards
This commit is contained in:
@@ -36,6 +36,7 @@ const portfolio: Portfolio = {
|
||||
currentValue: null,
|
||||
averagePurchasePrice: null,
|
||||
absoluteReturn: null,
|
||||
isin: null,
|
||||
},
|
||||
{
|
||||
figi: "FIGI-1",
|
||||
@@ -43,8 +44,9 @@ const portfolio: Portfolio = {
|
||||
type: "BOND",
|
||||
quantity: "1",
|
||||
currentValue: { currency: "RUB", value: "10" },
|
||||
averagePurchasePrice: null,
|
||||
averagePurchasePrice: { currency: "RUB", value: "11" },
|
||||
absoluteReturn: { currency: "RUB", value: "-1" },
|
||||
isin: "RU000A0JX0J2",
|
||||
},
|
||||
],
|
||||
cashBalances: [{ currency: "USD", value: "0.5" }],
|
||||
@@ -80,7 +82,7 @@ describe("AccountPage states", () => {
|
||||
expect(retry).toHaveBeenCalledOnce();
|
||||
});
|
||||
|
||||
it("renders a stale portfolio in upstream order with nullable values", () => {
|
||||
it("renders a stale portfolio in upstream order with nullable values hidden", () => {
|
||||
renderPage(<AccountPageLoaded portfolio={portfolio} />);
|
||||
|
||||
expect(
|
||||
@@ -91,16 +93,20 @@ describe("AccountPage states", () => {
|
||||
"T-Bank временно недоступен. Показан последний успешный снимок.",
|
||||
),
|
||||
).toBeInTheDocument();
|
||||
expect(screen.getByText("—")).toBeInTheDocument();
|
||||
expect(screen.getByText("Доход: —")).toBeInTheDocument();
|
||||
const positions = screen
|
||||
.getAllByText(/Вторая|Первая/)
|
||||
.map((element) => element.textContent);
|
||||
expect(positions).toEqual(["Вторая", "Первая"]);
|
||||
expect(screen.getByRole("heading", { name: "Акции" })).toBeInTheDocument();
|
||||
expect(
|
||||
screen.getByRole("heading", { name: "Облигации" }),
|
||||
).toBeInTheDocument();
|
||||
const positions = screen
|
||||
.getAllByText(/Вторая|Первая/)
|
||||
.map((element) => element.textContent);
|
||||
expect(positions).toEqual(["Вторая", "Первая"]);
|
||||
expect(screen.getByText("10 ₽")).toBeInTheDocument();
|
||||
expect(screen.getByText("Доход: -1 ₽")).toBeInTheDocument();
|
||||
expect(screen.getByText("Средняя цена: 11 ₽")).toBeInTheDocument();
|
||||
expect(screen.getByText("Доля: 100 %")).toBeInTheDocument();
|
||||
expect(screen.getByText("RU000A0JX0J2")).toBeInTheDocument();
|
||||
expect(screen.queryByText("—")).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("uses the cached account title when available", () => {
|
||||
|
||||
Reference in New Issue
Block a user