feat(portfolio): show stock tickers
This commit is contained in:
@@ -67,6 +67,7 @@ const portfolio: Portfolio = {
|
||||
averagePurchasePrice: null,
|
||||
absoluteReturn: null,
|
||||
isin: null,
|
||||
ticker: null,
|
||||
logoName: "vtoraya.png",
|
||||
},
|
||||
{
|
||||
@@ -78,6 +79,7 @@ const portfolio: Portfolio = {
|
||||
averagePurchasePrice: { currency: "RUB", value: "11" },
|
||||
absoluteReturn: { currency: "RUB", value: "-1" },
|
||||
isin: "RU000A0JX0J2",
|
||||
ticker: null,
|
||||
logoName: null,
|
||||
},
|
||||
],
|
||||
@@ -193,6 +195,7 @@ describe("AccountPage states", () => {
|
||||
averagePurchasePrice: null,
|
||||
absoluteReturn: { currency: "RUB", value: "3" },
|
||||
isin: null,
|
||||
ticker: null,
|
||||
logoName: null,
|
||||
},
|
||||
{
|
||||
@@ -204,6 +207,7 @@ describe("AccountPage states", () => {
|
||||
averagePurchasePrice: null,
|
||||
absoluteReturn: { currency: "RUB", value: "0" },
|
||||
isin: null,
|
||||
ticker: null,
|
||||
logoName: null,
|
||||
},
|
||||
],
|
||||
@@ -232,6 +236,7 @@ describe("AccountPage states", () => {
|
||||
averagePurchasePrice: { currency: "RUB", value: "11" },
|
||||
absoluteReturn: { currency: "RUB", value: "3" },
|
||||
isin: "RU000QUIET1",
|
||||
ticker: null,
|
||||
logoName: null,
|
||||
},
|
||||
],
|
||||
@@ -247,6 +252,62 @@ describe("AccountPage states", () => {
|
||||
).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("uses the ticker only for stock cards and otherwise keeps the ISIN", () => {
|
||||
renderPage(
|
||||
<AccountPageLoaded
|
||||
{...loadedProps({
|
||||
...portfolio,
|
||||
positions: [
|
||||
{
|
||||
figi: "FIGI-STOCK",
|
||||
displayName: "Акция с тикером",
|
||||
type: "STOCK",
|
||||
quantity: "1",
|
||||
currentValue: null,
|
||||
averagePurchasePrice: null,
|
||||
absoluteReturn: null,
|
||||
isin: "STOCK-ISIN",
|
||||
ticker: "SBER",
|
||||
logoName: null,
|
||||
},
|
||||
{
|
||||
figi: "FIGI-FALLBACK",
|
||||
displayName: "Акция без тикера",
|
||||
type: "STOCK",
|
||||
quantity: "2",
|
||||
currentValue: null,
|
||||
averagePurchasePrice: null,
|
||||
absoluteReturn: null,
|
||||
isin: "FALLBACK-ISIN",
|
||||
ticker: null,
|
||||
logoName: null,
|
||||
},
|
||||
{
|
||||
figi: "FIGI-BOND",
|
||||
displayName: "Облигация",
|
||||
type: "BOND",
|
||||
quantity: "3",
|
||||
currentValue: null,
|
||||
averagePurchasePrice: null,
|
||||
absoluteReturn: null,
|
||||
isin: "BOND-ISIN",
|
||||
ticker: "OFZ",
|
||||
logoName: null,
|
||||
},
|
||||
],
|
||||
})}
|
||||
/>,
|
||||
);
|
||||
|
||||
expect(screen.getByText("Количество: 1 · SBER")).toBeInTheDocument();
|
||||
expect(screen.queryByText("STOCK-ISIN")).not.toBeInTheDocument();
|
||||
expect(
|
||||
screen.getByText("Количество: 2 · FALLBACK-ISIN"),
|
||||
).toBeInTheDocument();
|
||||
expect(screen.getByText("Количество: 3 · BOND-ISIN")).toBeInTheDocument();
|
||||
expect(screen.queryByText("OFZ")).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("renders bond cards with logo, fallback, and signed unlabeled return like stocks", () => {
|
||||
renderPage(
|
||||
<AccountPageLoaded
|
||||
@@ -262,6 +323,7 @@ describe("AccountPage states", () => {
|
||||
averagePurchasePrice: null,
|
||||
absoluteReturn: { currency: "RUB", value: "2" },
|
||||
isin: "RU000C0XY1Z3",
|
||||
ticker: null,
|
||||
logoName: "dolg.png",
|
||||
},
|
||||
{
|
||||
@@ -273,6 +335,7 @@ describe("AccountPage states", () => {
|
||||
averagePurchasePrice: null,
|
||||
absoluteReturn: { currency: "RUB", value: "0" },
|
||||
isin: null,
|
||||
ticker: null,
|
||||
logoName: null,
|
||||
},
|
||||
],
|
||||
@@ -307,6 +370,7 @@ describe("AccountPage states", () => {
|
||||
averagePurchasePrice: { currency: "RUB", value: "950" },
|
||||
absoluteReturn: { currency: "RUB", value: "50" },
|
||||
isin: "RU000B0ND123",
|
||||
ticker: null,
|
||||
logoName: null,
|
||||
},
|
||||
],
|
||||
@@ -355,6 +419,7 @@ describe("AccountPage states", () => {
|
||||
averagePurchasePrice: null,
|
||||
absoluteReturn: { currency: "RUB", value: "-5" },
|
||||
isin: null,
|
||||
ticker: null,
|
||||
logoName: "fond.png",
|
||||
},
|
||||
],
|
||||
|
||||
@@ -24,6 +24,7 @@ const portfolio: Portfolio = {
|
||||
averagePurchasePrice: null,
|
||||
absoluteReturn: { currency: "RUB", value: "10" },
|
||||
isin: null,
|
||||
ticker: null,
|
||||
logoName: "akciya.png",
|
||||
},
|
||||
{
|
||||
@@ -35,6 +36,7 @@ const portfolio: Portfolio = {
|
||||
averagePurchasePrice: { currency: "RUB", value: "45" },
|
||||
absoluteReturn: { currency: "RUB", value: "-5" },
|
||||
isin: "RU000A0JX0J2",
|
||||
ticker: null,
|
||||
logoName: null,
|
||||
},
|
||||
{
|
||||
@@ -46,6 +48,7 @@ const portfolio: Portfolio = {
|
||||
averagePurchasePrice: null,
|
||||
absoluteReturn: null,
|
||||
isin: null,
|
||||
ticker: null,
|
||||
logoName: "fond.png",
|
||||
},
|
||||
],
|
||||
|
||||
@@ -45,9 +45,11 @@ const PositionCard: FC<PositionCardProps> = (props) => {
|
||||
value: position.returnText,
|
||||
})
|
||||
: null;
|
||||
const identifier =
|
||||
variant === "stock" ? (position.ticker ?? position.isin) : position.isin;
|
||||
const identifierText = [
|
||||
t("portfolio.quantity", { value: position.quantity }),
|
||||
position.isin,
|
||||
identifier,
|
||||
]
|
||||
.filter(Boolean)
|
||||
.join(" · ");
|
||||
|
||||
Reference in New Issue
Block a user