📋 Description
lib/utils/pagination.ts provides validatePaginationParams (clamps limit to 1..100, default 20) and the PaginatedResult<T> contract used by remittance/bills/goals routes. The clamping and cursor handling are untested, so a regression in the limit bounds would silently affect every paginated endpoint.
This issue adds a vitest suite for the pagination helpers.
Why this matters: these helpers are shared infrastructure; a single off-by-one in the clamp affects many routes at once.
🎯 Requirements & Context
Context & constraints
- Test-only; pure functions, no mocks needed.
🛠️ Suggested Execution
git checkout -b test/pagination-utils
- Add
tests/unit/pagination.test.ts.
- Edge cases:
limit: 0, limit: 1000, negative limit, empty cursor string.
npx vitest run && npx tsc --noEmit && npm run lint
test(utils): add pagination helper unit tests
✅ Acceptance Criteria & Guidelines
| Requirement |
Target |
| Clamp + default behaviour covered |
Required |
| Cursor handling covered |
Required |
Coverage of pagination.ts |
≥ 95% |
tsc --noEmit, lint clean |
Required |
| Timeframe |
96 hours from assignment |
💬 Community & Support
Join the RemitWise contributor community on Discord: https://discord.gg/CtQuPZFMA
Comment to claim and ask questions in the channel. 🚀
📋 Description
lib/utils/pagination.tsprovidesvalidatePaginationParams(clampslimitto 1..100, default 20) and thePaginatedResult<T>contract used by remittance/bills/goals routes. The clamping and cursor handling are untested, so a regression in the limit bounds would silently affect every paginated endpoint.This issue adds a vitest suite for the pagination helpers.
🎯 Requirements & Context
PaginatedResulthasMore/nextCursorshaping if a builder exists.Context & constraints
🛠️ Suggested Execution
tests/unit/pagination.test.ts.limit: 0,limit: 1000, negative limit, empty cursor string.✅ Acceptance Criteria & Guidelines
pagination.tstsc --noEmit,lintclean💬 Community & Support
Join the RemitWise contributor community on Discord: https://discord.gg/CtQuPZFMA
Comment to claim and ask questions in the channel. 🚀