feat(broker-operation): show operation type label in ledger entries

This commit is contained in:
2026-08-27 11:33:25 +03:00
parent 695cda0456
commit d53ce50e28
4 changed files with 91 additions and 20 deletions
@@ -61,7 +61,7 @@ describe("OperationRow", () => {
expect(screen.queryByText("Количество: 2")).toBeNull();
});
it("labels a positive payment as a Russian incoming amount", () => {
it("labels a positive payment with its category type", () => {
render(
<MantineProvider>
<MemoryRouter>
@@ -75,10 +75,70 @@ describe("OperationRow", () => {
</MantineProvider>,
);
expect(screen.getByText("Поступление")).toBeInTheDocument();
expect(screen.getByText("Сделка")).toBeInTheDocument();
expect(screen.getByText("+15 ₽")).toBeInTheDocument();
});
it("labels a coupon income as Купон", () => {
render(
<MantineProvider>
<MemoryRouter>
<OperationRow
operation={{
...operation,
type: "OPERATION_TYPE_COUPON",
category: "income",
payment: { currency: "RUB", value: "8" },
}}
/>
</MemoryRouter>
</MantineProvider>,
);
expect(screen.getByText("Купон")).toBeInTheDocument();
expect(screen.getByText("+8 ₽")).toBeInTheDocument();
});
it("labels a dividend income as Дивиденд", () => {
render(
<MantineProvider>
<MemoryRouter>
<OperationRow
operation={{
...operation,
type: "OPERATION_TYPE_DIVIDEND",
category: "income",
payment: { currency: "RUB", value: "20" },
}}
/>
</MemoryRouter>
</MantineProvider>,
);
expect(screen.getByText("Дивиденд")).toBeInTheDocument();
expect(screen.getByText("+20 ₽")).toBeInTheDocument();
});
it("labels a fee as Комиссия", () => {
render(
<MantineProvider>
<MemoryRouter>
<OperationRow
operation={{
...operation,
type: "OPERATION_TYPE_SERVICE_FEE",
category: "fee",
payment: { currency: "RUB", value: "-3" },
}}
/>
</MemoryRouter>
</MantineProvider>,
);
expect(screen.getByText("Комиссия")).toBeInTheDocument();
expect(screen.getByText("−3 ₽")).toBeInTheDocument();
});
it("keeps a zero payment neutral", () => {
render(
<MantineProvider>
@@ -94,7 +154,7 @@ describe("OperationRow", () => {
);
expect(screen.getByText("Без движения денег")).toBeInTheDocument();
expect(screen.queryByText("Поступление")).toBeNull();
expect(screen.queryByText("Сделка")).toBeNull();
});
it("uses an instrument initial when the ledger entry has no logo", () => {