refactor: enforce frontend view model boundaries
Frontend verify / commits (pull_request) Successful in 28s
Frontend verify / security (pull_request) Successful in 10s
Frontend verify / verify (pull_request) Successful in 8m19s

This commit is contained in:
2026-09-28 18:48:23 +03:00
parent 5b69003516
commit ca0ad4f824
287 changed files with 8558 additions and 4538 deletions
@@ -23,27 +23,34 @@ it("keeps expanded positions vertical while other positions adapt to the viewpor
"bonds",
"other",
];
const width = window.innerWidth;
expect([375, 1280]).toContain(width);
for (const kind of kinds) {
const otherType = kind === "bonds" ? "BOND" : "FUND";
const positions: AccountPagePosition[] = [1, 2, 3].map(index => ((/* eslint-disable unicorn/no-null -- Fixture preserves the production contract’s explicit null values. */
{
absoluteReturn: null,
averagePurchasePrice: null,
currentValue: { currency: "RUB", value: "1000" },
displayName: `Инструмент ${index}`,
figi: null,
isin: null,
logoName: null,
logoSrc: null,
quantity: "10",
returnText: null,
shareText: null,
ticker: null,
type: kind === "stocks" ? "STOCK" : otherType,
}
/* eslint-enable unicorn/no-null */)));
const positions: AccountPagePosition[] = [1, 2, 3].map(
/* eslint-disable unicorn/no-null -- Fixture preserves the production contract’s explicit null values. */
index =>
({
absoluteReturn: null,
averagePurchasePrice: null,
currentValue: { currency: "RUB", value: "1000" },
displayName: `Инструмент ${index}`,
figi: null,
isin: null,
logoName: null,
logoSrc: null,
quantity: "10",
returnText: null,
shareText: null,
ticker: null,
type: kind === "stocks" ? "STOCK" : otherType,
}),
/* eslint-enable unicorn/no-null */
);
const { unmount } = render(
<MantineProvider
cssVariablesResolver={cssVariablesResolver}
@@ -61,15 +68,19 @@ it("keeps expanded positions vertical while other positions adapt to the viewpor
/>
</MantineProvider>,
);
const bounds = positions.map(position =>
screen.getByText(position.displayName).getBoundingClientRect(),
);
const context = `${kind} at ${width}px`;
for (const [index, current] of bounds.entries()) {
expect(current.width, context).toBeGreaterThan(0);
expect(current.height, context).toBeGreaterThan(0);
if (index === 0) continue;
const previous = bounds[index - 1];
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.
expect(current.top, context).toBeCloseTo(previous.top, 0);
@@ -83,6 +94,7 @@ it("keeps expanded positions vertical while other positions adapt to the viewpor
expect(current.top, context).toBeGreaterThan(previous.bottom);
}
}
unmount();
}
});