fix: remove income analytics period limit
This commit is contained in:
@@ -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(
|
||||
<MantineProvider>
|
||||
<QueryWrapper>
|
||||
<MemoryRouter
|
||||
initialEntries={[
|
||||
"/accounts/account-1/income?from=2026-08-01&to=2026-08-27",
|
||||
]}
|
||||
>
|
||||
<MemoryRouter initialEntries={[`/accounts/account-1/income?${search}`]}>
|
||||
<Routes>
|
||||
<Route
|
||||
path="/accounts/:accountId/income"
|
||||
@@ -134,6 +130,23 @@ function renderPage() {
|
||||
}
|
||||
|
||||
describe("AccountIncomePage", () => {
|
||||
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 = {
|
||||
|
||||
@@ -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
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -191,7 +191,8 @@ const ru = {
|
||||
"Это известный прогноз, а не гарантированное поступление.",
|
||||
validation: {
|
||||
date: "Введите существующую дату.",
|
||||
period: "Укажите период до 366 дней без будущих дат.",
|
||||
period:
|
||||
"Укажите корректный период без будущих дат: начало не позже окончания.",
|
||||
},
|
||||
},
|
||||
settings: { title: "Настройки" },
|
||||
|
||||
Reference in New Issue
Block a user