feat: unify income payment cards and drop period comparisons (WealthLedger/main#33) (#83)
Backend verify / commits (push) Skipped
Backend verify / security (push) Successful in 13s
Backend verify / verify (push) Failing after 7m1s

feat: unify income payment cards and drop period comparisons (WealthLedger/main#33)
This commit was merged in pull request #83.
This commit is contained in:
2026-10-13 18:16:46 +03:00
parent 90486d4237
commit 31b0e15579
14 changed files with 230 additions and 274 deletions
@@ -17,7 +17,7 @@ describe('screen dependency and history planning', () => {
},
],
};
it('prioritizes discovery, selected/comparisons, then history; Moscow dates are converted once', () => {
it('prioritizes discovery, the selected period, then history; Moscow dates are converted once', () => {
const plan = planInvestmentScreen(
{
screen: 'income',
@@ -32,6 +32,17 @@ describe('screen dependency and history planning', () => {
const selected = plan.sources.filter(
(source) => source.kind === 'operations' && source.priority === 'screen',
);
// The single selected range is chunked into month-aligned intervals.
expect(selected).toHaveLength(2);
expect(
selected.every(
(source) =>
source.from != null &&
source.from.toISOString() >= '2024-01-31T21:00:00.000Z' &&
source.to != null &&
source.to.toISOString() <= '2024-02-29T21:00:00.000Z',
),
).toBe(true);
expect(
selected.some(
(source) => source.from?.toISOString() === '2024-01-31T21:00:00.000Z',
@@ -42,9 +53,7 @@ describe('screen dependency and history planning', () => {
(source) => source.to?.toISOString() === '2024-02-29T21:00:00.000Z',
),
).toBe(true);
expect(plan.unavailable).toEqual([
{ resourceKey: 'income/yearAgo', reason: 'calendar_or_account_boundary' }, // gitleaks:allow public resource identifier
]);
expect(plan.unavailable).toEqual([]);
const firstHistory = plan.sources.findIndex(
(source) => source.priority === 'history',
);