refactor: tighten types and reuse instrument UI
Frontend verify / commits (pull_request) Successful in 24s
Frontend verify / security (pull_request) Failing after 9s
Frontend verify / verify (pull_request) Skipped

This commit is contained in:
2026-09-29 06:15:31 +03:00
parent b404c1802a
commit 7c28a423dd
67 changed files with 380 additions and 347 deletions
@@ -67,7 +67,7 @@ function renderPage(ui: React.ReactNode) {
);
}
const portfolio: Portfolio
const portfolio
= {
cashBalances: [{ currency: "USD", value: "0.5" }],
isStale: true,
@@ -97,10 +97,10 @@ const portfolio: Portfolio
ticker: null,
type: "BOND",
},
],
] satisfies [Portfolio["positions"][number], ...Portfolio["positions"]],
structure: { currencies: [], unvaluedCategories: [] },
totalsByCurrency: [{ currency: "RUB", value: "1234.5" }],
};
} satisfies Portfolio;
function position(
overrides: Partial<Portfolio["positions"][number]>,
@@ -1,7 +1,7 @@
import { MantineProvider } from "@mantine/core";
import { render, screen, within } from "@testing-library/react";
import { MemoryRouter } from "react-router";
import { describe, expect, it } from "vitest";
import { assert, describe, expect, it } from "vitest";
import { toAccountPagePositionSections } from "../../model/positions";
import { portfolio, position, second } from "../../model/positions.fixtures";
@@ -13,6 +13,8 @@ describe("Positions grouped by security", () => {
...portfolio, positions: [position, second],
})[0];
assert.isDefined(section);
render(
<MantineProvider>
<MemoryRouter>
@@ -27,6 +29,8 @@ describe("Positions grouped by security", () => {
).getAllByRole("listitem");
expect(rows).toHaveLength(2);
assert.isDefined(rows[0]);
assert.isDefined(rows[1]);
expect(
within(rows[0]).getByRole("link", { name: "Основной" }),
).toHaveAttribute("href", "/accounts/a");
@@ -6,7 +6,7 @@ import { MantineProvider } from "@mantine/core";
// eslint-disable-next-line testing-library/no-manual-cleanup -- Vitest globals are disabled, so RTL cannot register its automatic afterEach cleanup.
import { cleanup, render, screen } from "@testing-library/react";
import { cssVariablesResolver, theme } from "@wealthledger/ui/theme";
import { afterEach, expect, it } from "vitest";
import { afterEach, assert, expect, it } from "vitest";
import type { AccountPagePosition, AccountPagePositionSection } from "../../model/positions";
@@ -76,6 +76,7 @@ it("keeps expanded positions vertical while other positions adapt to the viewpor
expect(current.height, context).toBeGreaterThan(0);
if (index === 0) continue;
const previous = bounds[index - 1];
assert.isDefined(previous);
if (kind === "other" && width === 1280) {
// eslint-disable-next-line vitest/no-conditional-expect -- The fixed table case selects the expected outcome; every case asserts its own branch.