Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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);');
});
});

Check failure on line 12 in backend/src/controllers/__tests__/transactionControllerLimits.test.ts

View workflow job for this annotation

GitHub Actions / backend

Insert `⏎`
2 changes: 1 addition & 1 deletion backend/src/controllers/transactionController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading