feat: add bond pages and portfolio navigation

This commit is contained in:
2026-09-10 22:30:47 +03:00
parent 561222e468
commit 232d7f9990
39 changed files with 4217 additions and 221 deletions
+18 -8
View File
@@ -121,15 +121,22 @@ function emptyProps() {
}
describe("AccountPage states", () => {
it.each(["account-1", "all"])(
"uses verified ticker hrefs for both name and logo in %s",
async (accountId) => {
it.each(
["account-1", "all"].flatMap((accountId) =>
["STOCK", "BOND"].map((type) => ({ accountId, type })),
),
)(
"links name and logo to the exact issue in $accountId for $type",
async ({ accountId, type }) => {
const collection = type === "STOCK" ? "stocks" : "bonds";
const slug = type === "STOCK" ? "SBERP" : "SU26238RMFS4";
const uid = "c190ff1f-1447-4227-b543-316332699ca5";
const requests = vi.fn();
const position = {
...portfolio.positions[0],
type,
instrumentUid: uid,
ticker: "SBERP",
ticker: slug,
displayName: "Сбербанк привилегированные",
};
server.use(
@@ -145,9 +152,9 @@ describe("AccountPage states", () => {
: [position],
}),
),
http.get("*/api/v1/stocks/:uid", () => {
http.get(`*/api/v1/${collection}/:uid`, () => {
requests();
return HttpResponse.json({ instrumentUid: uid, slug: "SBERP" });
return HttpResponse.json({ instrumentUid: uid, slug });
}),
);
configureTestAuth();
@@ -158,9 +165,12 @@ describe("AccountPage states", () => {
});
expect(links).toHaveLength(2);
for (const link of links)
expect(link).toHaveAttribute("href", "/stocks/SBERP");
expect(link).toHaveAttribute(
"href",
`/${collection}/${type === "STOCK" ? slug : uid}`,
);
});
expect(requests).toHaveBeenCalledOnce();
expect(requests).toHaveBeenCalledTimes(type === "STOCK" ? 1 : 0);
},
);