feat: render stock logos with signed returns on account page
This commit is contained in:
@@ -56,6 +56,7 @@ const portfolio: Portfolio = {
|
||||
averagePurchasePrice: null,
|
||||
absoluteReturn: null,
|
||||
isin: null,
|
||||
logoName: "vtoraya.png",
|
||||
},
|
||||
{
|
||||
figi: "FIGI-1",
|
||||
@@ -66,6 +67,7 @@ const portfolio: Portfolio = {
|
||||
averagePurchasePrice: { currency: "RUB", value: "11" },
|
||||
absoluteReturn: { currency: "RUB", value: "-1" },
|
||||
isin: "RU000A0JX0J2",
|
||||
logoName: null,
|
||||
},
|
||||
],
|
||||
cashBalances: [{ currency: "USD", value: "0.5" }],
|
||||
@@ -126,6 +128,49 @@ describe("AccountPage states", () => {
|
||||
expect(screen.getByText("Доля: 100 %")).toBeInTheDocument();
|
||||
expect(screen.getByText("RU000A0JX0J2")).toBeInTheDocument();
|
||||
expect(screen.queryByText("—")).not.toBeInTheDocument();
|
||||
expect(screen.getByRole("img", { name: "Вторая" })).toHaveAttribute(
|
||||
"src",
|
||||
"https://invest-brands.cdn-tinkoff.ru/vtorayax160.png",
|
||||
);
|
||||
});
|
||||
|
||||
it("renders stock cards with logo fallback and signed unlabeled return", () => {
|
||||
renderPage(
|
||||
<AccountPageLoaded
|
||||
portfolio={{
|
||||
...portfolio,
|
||||
positions: [
|
||||
{
|
||||
figi: "FIGI-A",
|
||||
displayName: "Абра",
|
||||
type: "STOCK",
|
||||
quantity: "1",
|
||||
currentValue: { currency: "RUB", value: "5" },
|
||||
averagePurchasePrice: null,
|
||||
absoluteReturn: { currency: "RUB", value: "3" },
|
||||
isin: null,
|
||||
logoName: null,
|
||||
},
|
||||
{
|
||||
figi: "FIGI-B",
|
||||
displayName: "Кадабра",
|
||||
type: "STOCK",
|
||||
quantity: "1",
|
||||
currentValue: { currency: "RUB", value: "7" },
|
||||
averagePurchasePrice: null,
|
||||
absoluteReturn: { currency: "RUB", value: "0" },
|
||||
isin: null,
|
||||
logoName: null,
|
||||
},
|
||||
],
|
||||
}}
|
||||
/>,
|
||||
);
|
||||
expect(screen.getByText("А")).toBeInTheDocument();
|
||||
expect(screen.getByText("+3 ₽")).toBeInTheDocument();
|
||||
expect(screen.getByText("0 ₽")).toBeInTheDocument();
|
||||
expect(screen.queryByText(/Доход:/)).not.toBeInTheDocument();
|
||||
expect(screen.queryByRole("img", { name: "Абра" })).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("uses the cached account title when available", () => {
|
||||
|
||||
Reference in New Issue
Block a user