feat: show return, cash and structure on account cards (#114)
Frontend verify / commits (pull_request) Successful in 29s
Frontend verify / security (pull_request) Successful in 8s
Frontend verify / verify (pull_request) Successful in 5m25s
Frontend verify / commits (push) Skipped
Frontend verify / security (push) Successful in 9s
Frontend verify / verify (push) Failing after 5m20s
Frontend verify / commits (pull_request) Successful in 29s
Frontend verify / security (pull_request) Successful in 8s
Frontend verify / verify (pull_request) Successful in 5m25s
Frontend verify / commits (push) Skipped
Frontend verify / security (push) Successful in 9s
Frontend verify / verify (push) Failing after 5m20s
This commit was merged in pull request #116.
This commit is contained in:
@@ -31,6 +31,19 @@ function configureTestAuth() {
|
||||
});
|
||||
}
|
||||
|
||||
function portfolioSummary(totals: { currency: string; value: string }[]) {
|
||||
return {
|
||||
bondPositionCount: 1,
|
||||
cashBalances: [],
|
||||
fundPositionCount: 0,
|
||||
stockPositionCount: 0,
|
||||
structure: { currencies: [], unvaluedCategories: [] },
|
||||
totalPositionCount: 1,
|
||||
totalsByCurrency: totals,
|
||||
unrealizedReturnByCurrency: [],
|
||||
};
|
||||
}
|
||||
|
||||
function renderPage(queryClient: QueryClient) {
|
||||
configureTestAuth();
|
||||
|
||||
@@ -46,6 +59,65 @@ function renderPage(queryClient: QueryClient) {
|
||||
}
|
||||
|
||||
describe("AccountsPage", () => {
|
||||
it("summarizes currencies separately 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" },
|
||||
]),
|
||||
},
|
||||
{
|
||||
...account,
|
||||
id: "account-2",
|
||||
name: "Второй",
|
||||
portfolioSummary: portfolioSummary([
|
||||
{ currency: "RUB", value: "50.20" },
|
||||
]),
|
||||
},
|
||||
{
|
||||
...account,
|
||||
id: "account-3",
|
||||
name: "Без сводки",
|
||||
portfolioSummary: null,
|
||||
},
|
||||
{
|
||||
...account,
|
||||
id: "account-4",
|
||||
name: "Только деньги",
|
||||
portfolioSummary: {
|
||||
...portfolioSummary([{ currency: "RUB", value: "25" }]),
|
||||
bondPositionCount: 0,
|
||||
cashBalances: [{ currency: "RUB", value: "25" }],
|
||||
totalPositionCount: 0,
|
||||
},
|
||||
},
|
||||
{
|
||||
...account,
|
||||
id: "account-5",
|
||||
name: "Без сумм",
|
||||
portfolioSummary: {
|
||||
...portfolioSummary([]),
|
||||
totalPositionCount: 0,
|
||||
},
|
||||
},
|
||||
])),
|
||||
));
|
||||
const client = createTestQueryClient();
|
||||
|
||||
renderPage(client);
|
||||
|
||||
expect(await screen.findByText("175,30 ₽")).toBeInTheDocument();
|
||||
expect(screen.getAllByText("20,00 USD")).not.toHaveLength(0);
|
||||
expect(screen.getByText("5 счетов")).toBeInTheDocument();
|
||||
expect(screen.getByText("Нет текущих сумм")).toBeInTheDocument();
|
||||
expect(screen.getByText(
|
||||
"Ещё 1 счёт не включён: нет актуального портфеля",
|
||||
)).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("loads accounts after retrying an initial HTTP failure", async () => {
|
||||
const modes: (null | string)[] = [];
|
||||
server.use(
|
||||
|
||||
Reference in New Issue
Block a user