feat: enrich dashboard filters and feedback

This commit is contained in:
2026-08-20 22:31:41 +03:30
parent 9ce2e6ec83
commit 458ab69a3c
24 changed files with 1895 additions and 340 deletions

View File

@@ -10,6 +10,7 @@ describe('dashboard filters', () => {
expect(parseDashboardFilters(query, terminals)).toEqual({
range: 'month',
period: '',
terminal: 'all',
status: 'all',
minAmount: null,
@@ -29,6 +30,34 @@ describe('dashboard filters', () => {
},
);
it('keeps an offered reporting period in the copied URL without dropping other filters', () => {
const filters = parseDashboardFilters(
new URLSearchParams('range=month&period=jm-1405-05&terminal=T83&status=Verified'),
terminals,
);
expect(filters.period).toBe('jm-1405-05');
const next = setDashboardQuery(
new URL('https://example.test/transactions?range=month&terminal=T83&status=Verified'),
{ period: filters.period },
);
expect(next.searchParams.get('period')).toBe('jm-1405-05');
expect(next.searchParams.get('range')).toBe('month');
expect(next.searchParams.get('terminal')).toBe('T83');
expect(next.searchParams.get('status')).toBe('Verified');
});
it('rejects reporting period identifiers outside the server formats', () => {
const filters = parseDashboardFilters(
new URLSearchParams('range=day&period=javascript:alert(1)'),
terminals,
);
expect(filters.period).toBe('');
});
it('normalizes an inverted amount range', () => {
const filters = parseDashboardFilters(
new URLSearchParams('minAmount=900000&maxAmount=100000'),