diff --git a/backend/src/controllers/__tests__/transactionControllerLimits.test.ts b/backend/src/controllers/__tests__/transactionControllerLimits.test.ts new file mode 100644 index 00000000..ec6b1491 --- /dev/null +++ b/backend/src/controllers/__tests__/transactionControllerLimits.test.ts @@ -0,0 +1,12 @@ +import { describe, expect, it } from '@jest/globals'; +import { readFileSync } from 'node:fs'; + +const source = readFileSync(new URL('../transactionController.ts', import.meta.url), 'utf8'); + +describe('transactionController pagination limits', () => { + it('caps transaction pages at the intended small maximum', () => { + expect(source).toContain('const MAX_LIMIT = 50;'); + expect(source).not.toContain('const MAX_LIMIT = 500;'); + expect(source).toContain('return Math.min(parsed, MAX_LIMIT);'); + }); +}); \ No newline at end of file diff --git a/backend/src/controllers/transactionController.ts b/backend/src/controllers/transactionController.ts index a5980689..1a1dea5f 100644 --- a/backend/src/controllers/transactionController.ts +++ b/backend/src/controllers/transactionController.ts @@ -4,7 +4,7 @@ import { AppError } from '../errors/AppError.js'; import { asyncHandler } from '../utils/asyncHandler.js'; const DEFAULT_LIMIT = 20; -const MAX_LIMIT = 500; +const MAX_LIMIT = 50; function parseLimit(value: unknown): number { if (typeof value !== 'string') return DEFAULT_LIMIT;