refactor!: support RUB only (WealthLedger/main#55)
Adopt RUB-only API contract; remove currency cards, selectors, screener currency filter and multi-currency branches. BREAKING CHANGE: requires the RUB-only backend contract.
This commit is contained in:
@@ -31,16 +31,26 @@ function configureTestAuth() {
|
||||
});
|
||||
}
|
||||
|
||||
function portfolioSummary(totals: { currency: string; value: string }[]) {
|
||||
function portfolioSummary(totals: { currency: string; value: string }) {
|
||||
return {
|
||||
bondPositionCount: 1,
|
||||
cashBalances: [],
|
||||
cash: { currency: "RUB", value: "0" },
|
||||
fundPositionCount: 0,
|
||||
stockPositionCount: 0,
|
||||
structure: { currencies: [], unvaluedCategories: [] },
|
||||
structure: {
|
||||
categories: [],
|
||||
hasNegativeValues: false,
|
||||
totalValue: "0",
|
||||
unvaluedCategories: [],
|
||||
},
|
||||
totalPositionCount: 1,
|
||||
totalsByCurrency: totals,
|
||||
unrealizedReturnByCurrency: [],
|
||||
totals,
|
||||
unrealizedReturn: {
|
||||
absolute: "0",
|
||||
costBasis: "0",
|
||||
partial: false,
|
||||
percent: null,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -59,23 +69,18 @@ function renderPage(queryClient: QueryClient) {
|
||||
}
|
||||
|
||||
describe("AccountsPage", () => {
|
||||
it("summarizes currencies separately and reports excluded accounts", async () => {
|
||||
it("summarizes account totals and reports excluded accounts", async () => {
|
||||
server.use(http.get("*/api/v1/brokerage-accounts", () =>
|
||||
HttpResponse.json(resource([
|
||||
{
|
||||
...account,
|
||||
portfolioSummary: portfolioSummary([
|
||||
{ currency: "RUB", value: "100.10" },
|
||||
{ currency: "USD", value: "20" },
|
||||
]),
|
||||
portfolioSummary: portfolioSummary({ currency: "RUB", value: "100.10" }),
|
||||
},
|
||||
{
|
||||
...account,
|
||||
id: "account-2",
|
||||
name: "Второй",
|
||||
portfolioSummary: portfolioSummary([
|
||||
{ currency: "RUB", value: "50.20" },
|
||||
]),
|
||||
portfolioSummary: portfolioSummary({ currency: "RUB", value: "50.20" }),
|
||||
},
|
||||
{
|
||||
...account,
|
||||
@@ -88,9 +93,9 @@ describe("AccountsPage", () => {
|
||||
id: "account-4",
|
||||
name: "Только деньги",
|
||||
portfolioSummary: {
|
||||
...portfolioSummary([{ currency: "RUB", value: "25" }]),
|
||||
...portfolioSummary({ currency: "RUB", value: "25" }),
|
||||
bondPositionCount: 0,
|
||||
cashBalances: [{ currency: "RUB", value: "25" }],
|
||||
cash: { currency: "RUB", value: "25" },
|
||||
totalPositionCount: 0,
|
||||
},
|
||||
},
|
||||
@@ -99,7 +104,7 @@ describe("AccountsPage", () => {
|
||||
id: "account-5",
|
||||
name: "Без сумм",
|
||||
portfolioSummary: {
|
||||
...portfolioSummary([]),
|
||||
...portfolioSummary({ currency: "RUB", value: "0" }),
|
||||
totalPositionCount: 0,
|
||||
},
|
||||
},
|
||||
@@ -110,7 +115,6 @@ describe("AccountsPage", () => {
|
||||
renderPage(client);
|
||||
|
||||
expect(await screen.findByText("175,30 ₽")).toBeInTheDocument();
|
||||
expect(screen.getAllByText("20,00 $")).not.toHaveLength(0);
|
||||
expect(screen.queryByText("Ваши инвестиции по счетам"))
|
||||
.not.toBeInTheDocument();
|
||||
expect(screen.getByText("5 счетов")).toBeInTheDocument();
|
||||
|
||||
Reference in New Issue
Block a user