Files
frontend/src/entities/portfolio/model/display.test.ts
T
ksv741 3eafad2657
Frontend security / security (push) Successful in 9s
Frontend verify / verify (push) Failing after 37m50s
Frontend security / security (pull_request) Successful in 9s
Frontend verify / verify (pull_request) Failing after 42m10s
Conventional commits / commits (pull_request) Successful in 29s
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.
2026-09-28 07:31:28 +03:00

29 lines
744 B
TypeScript

import { describe, expect, it } from "vitest";
import { formatShare } from "./display";
describe("portfolio display helpers", () => {
it("formats a share as a display-only percentage", () => {
expect(
formatShare(
{ currency: "RUB", value: "150" },
{ currency: "RUB", value: "1000" },
),
).toBe("15 %");
expect(
formatShare(
{ currency: "RUB", value: "123.45" },
{ currency: "RUB", value: "999.99" },
),
).toBe("12,3 %");
expect(formatShare(null, { currency: "RUB", value: "100" })).toBeNull();
expect(formatShare({ currency: "RUB", value: "100" }, null)).toBeNull();
expect(
formatShare(
{ currency: "RUB", value: "100" },
{ currency: "RUB", value: "0" },
),
).toBeNull();
});
});