From ab1b53680d811e5b5f91e8e14a7f219274e57313 Mon Sep 17 00:00:00 2001 From: Sergey Krylov Date: Wed, 9 Sep 2026 11:10:10 +0300 Subject: [PATCH] fix: remove income analytics period limit --- .../ui/AccountIncomePage.test.tsx | 25 ++++++++++++++----- .../account-income/ui/AccountIncomePage.vm.ts | 3 +-- src/shared/i18n/locales/ru.ts | 3 ++- 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/src/pages/account-income/ui/AccountIncomePage.test.tsx b/src/pages/account-income/ui/AccountIncomePage.test.tsx index fa6daec..65facc3 100644 --- a/src/pages/account-income/ui/AccountIncomePage.test.tsx +++ b/src/pages/account-income/ui/AccountIncomePage.test.tsx @@ -102,7 +102,7 @@ function entry(): IncomeAnalytics["entries"][number] { }; } -function renderPage() { +function renderPage(search = "from=2026-08-01&to=2026-08-27") { configureAuthClient({ accessToken: () => "token", refresh: async () => true, @@ -112,11 +112,7 @@ function renderPage() { return render( - + { + it("requests a multi-year period from the URL without resetting it", async () => { + const requested: string[] = []; + server.use( + http.get( + "*/api/v1/brokerage-accounts/:accountId/income-analytics", + ({ request }) => { + requested.push(new URL(request.url).search); + return HttpResponse.json(analytics); + }, + ), + ); + renderPage("from=2020-01-01&to=2025-12-31"); + await waitFor(() => + expect(requested).toContain("?from=2020-01-01&to=2025-12-31"), + ); + }); + it("preserves every repeated-ID payment when an open drill-down updates", async () => { const first = { ...entry(), id: "same-id", description: "Выплата A" }; const second = { diff --git a/src/pages/account-income/ui/AccountIncomePage.vm.ts b/src/pages/account-income/ui/AccountIncomePage.vm.ts index abc7050..0511e21 100644 --- a/src/pages/account-income/ui/AccountIncomePage.vm.ts +++ b/src/pages/account-income/ui/AccountIncomePage.vm.ts @@ -138,8 +138,7 @@ function validPeriod(period: IncomePeriod): period is IncomePeriod { from.toISOString().slice(0, 10) === period.from && to.toISOString().slice(0, 10) === period.to && from <= to && - to <= today && - (to.valueOf() - from.valueOf()) / 86_400_000 + 1 <= 366 + to <= today ); } diff --git a/src/shared/i18n/locales/ru.ts b/src/shared/i18n/locales/ru.ts index 0e3eb4e..e089421 100644 --- a/src/shared/i18n/locales/ru.ts +++ b/src/shared/i18n/locales/ru.ts @@ -191,7 +191,8 @@ const ru = { "Это известный прогноз, а не гарантированное поступление.", validation: { date: "Введите существующую дату.", - period: "Укажите период до 366 дней без будущих дат.", + period: + "Укажите корректный период без будущих дат: начало не позже окончания.", }, }, settings: { title: "Настройки" },