chore: finish frontend ESLint migration #18
Enable every plugin recommended preset and replace Biome with ESLint formatting. Preserve API contracts and JSX whitespace; verify source, tests, builds and tooling.
This commit is contained in:
+44
-36
@@ -2,7 +2,9 @@ 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 { resource } from "@/test/resource";
|
||||
|
||||
import { brokerageAccountCards } from "../../model/display";
|
||||
import { BrokerageAccountList } from "./BrokerageAccountList";
|
||||
|
||||
@@ -16,36 +18,40 @@ describe("BrokerageAccountList", () => {
|
||||
{
|
||||
id: "account-1",
|
||||
name: "Основной",
|
||||
type: "BROKERAGE",
|
||||
openedOn: "2024-08-13",
|
||||
portfolioSummary: {
|
||||
stockPositionCount: 5,
|
||||
bondPositionCount: 12,
|
||||
stockPositionCount: 5,
|
||||
totalsByCurrency: [
|
||||
{ currency: "RUB", value: "1500" },
|
||||
{ currency: "USD", value: "20" },
|
||||
{ currency: "EUR", value: "5" },
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "account-2",
|
||||
name: "Недоступный",
|
||||
type: "BROKERAGE",
|
||||
openedOn: null,
|
||||
portfolioSummary: null,
|
||||
},
|
||||
{
|
||||
id: "account-3",
|
||||
name: "Пустой",
|
||||
type: "BROKERAGE",
|
||||
openedOn: null,
|
||||
portfolioSummary: {
|
||||
totalsByCurrency: [],
|
||||
stockPositionCount: 2,
|
||||
bondPositionCount: 0,
|
||||
},
|
||||
},
|
||||
(/* eslint-disable unicorn/no-null -- Fixture preserves the production contract’s explicit null values. */
|
||||
{
|
||||
id: "account-2",
|
||||
name: "Недоступный",
|
||||
openedOn: null,
|
||||
portfolioSummary: null,
|
||||
type: "BROKERAGE",
|
||||
}
|
||||
/* eslint-enable unicorn/no-null */),
|
||||
(/* eslint-disable unicorn/no-null -- Fixture preserves the production contract’s explicit null values. */
|
||||
{
|
||||
id: "account-3",
|
||||
name: "Пустой",
|
||||
openedOn: null,
|
||||
portfolioSummary: {
|
||||
bondPositionCount: 0,
|
||||
stockPositionCount: 2,
|
||||
totalsByCurrency: [],
|
||||
},
|
||||
type: "BROKERAGE",
|
||||
}
|
||||
/* eslint-enable unicorn/no-null */),
|
||||
])}
|
||||
/>
|
||||
</MemoryRouter>
|
||||
@@ -65,18 +71,18 @@ describe("BrokerageAccountList", () => {
|
||||
expect(screen.getByText("Нет текущих сумм")).toBeInTheDocument();
|
||||
expect(screen.getAllByText("Открыть счет")).toHaveLength(3);
|
||||
const available = within(screen.getByRole("link", { name: /Основной/ }));
|
||||
expect(available.getByText("Акции").nextElementSibling).toHaveTextContent(
|
||||
expect(available.getAllByRole("definition")[0]).toHaveTextContent(
|
||||
"5",
|
||||
);
|
||||
expect(
|
||||
available.getByText("Облигации").nextElementSibling,
|
||||
available.getAllByRole("definition")[1],
|
||||
).toHaveTextContent("12");
|
||||
const unvalued = within(screen.getByRole("link", { name: /Пустой/ }));
|
||||
expect(unvalued.getByText("Акции").nextElementSibling).toHaveTextContent(
|
||||
expect(unvalued.getAllByRole("definition")[0]).toHaveTextContent(
|
||||
"2",
|
||||
);
|
||||
expect(
|
||||
unvalued.getByText("Облигации").nextElementSibling,
|
||||
unvalued.getAllByRole("definition")[1],
|
||||
).toHaveTextContent("0");
|
||||
expect(
|
||||
within(screen.getByRole("link", { name: /Недоступный/ })).queryByText(
|
||||
@@ -88,21 +94,23 @@ describe("BrokerageAccountList", () => {
|
||||
|
||||
it("shows portfolio summary freshness independently for each account", () => {
|
||||
const accounts = brokerageAccountCards(
|
||||
["fresh", "stale"].map((id) => ({
|
||||
id,
|
||||
name: id,
|
||||
type: "BROKERAGE" as const,
|
||||
openedOn: null,
|
||||
portfolioSummary: {
|
||||
stockPositionCount: 1,
|
||||
bondPositionCount: 0,
|
||||
totalsByCurrency: [{ currency: "RUB", value: "10" }],
|
||||
},
|
||||
})),
|
||||
["fresh", "stale"].map(id => ((/* eslint-disable unicorn/no-null -- Fixture preserves the production contract’s explicit null values. */
|
||||
{
|
||||
id,
|
||||
name: id,
|
||||
openedOn: null,
|
||||
portfolioSummary: {
|
||||
bondPositionCount: 0,
|
||||
stockPositionCount: 1,
|
||||
totalsByCurrency: [{ currency: "RUB", value: "10" }],
|
||||
},
|
||||
type: "BROKERAGE" as const,
|
||||
}
|
||||
/* eslint-enable unicorn/no-null */))),
|
||||
[
|
||||
resource(null, { resourceKey: "portfolio/fresh", freshness: "fresh" })
|
||||
resource(null, { freshness: "fresh", resourceKey: "portfolio/fresh" })
|
||||
.meta,
|
||||
resource(null, { resourceKey: "portfolio/stale", freshness: "stale" })
|
||||
resource(null, { freshness: "stale", resourceKey: "portfolio/stale" })
|
||||
.meta,
|
||||
],
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user