Test pair-meta PATCH validation and info aggregation
Description
The pair-meta endpoints in src/index.ts — PATCH .../fee_bps, /min, /max, /liquidity, and GET .../info — have only two tests in src/__tests__/index.test.ts (a happy-path fee patch and one 404). The validation branches (feeBps range, integer-string regexes for min/max/liquidity) and the aggregate /info defaults are untested. This issue adds thorough coverage for these handlers.
Requirements and context
- Repository scope:
StableRoute-Org/Stableroute-backend only.
- Add tests for each PATCH endpoint covering valid input, out-of-range/invalid input (e.g.
feeBps: 1001, minAmount: "01", maxAmount: "0"), and unregistered-pair 404.
- Assert
GET .../info returns the registered flag plus default meta (feeBps: 0, minAmount: "0", etc.) before any patch.
- Confirm the canonical
{ error, message, requestId } shape on each 400/404.
Suggested execution
- Fork the repo and create a branch
git checkout -b test/pairs-15-meta-coverage
- Implement changes
- Write comprehensive tests in:
src/__tests__/index.test.ts (or a new src/__tests__/pairMeta.test.ts).
- Add documentation: none required beyond test descriptions.
- Use descriptive
it() names mirroring the existing suite style.
- Validate security: include the array/object-as-value rejection cases.
- Test and commit
Test and commit
- Run
npm run build, npm run lint, and npm test.
- Cover edge cases: boundary
feeBps 0 and 1000, leading-zero amounts, maxAmount of 0.
- Paste full
npm test output and a coverage summary in the PR.
Example commit message
test(pairs): cover pair-meta PATCH validation and info defaults
Guidelines
- Minimum 95 percent test coverage for impacted code.
- Clear, reviewer-focused documentation.
- Timeframe: 96 hours.
Community & contribution rewards
- 💬 Join the StableRoute community on Discord for questions, reviews, and faster merges: https://discord.gg/37aCpusvx
- ⭐ This is a GrantFox OSS / Official Campaign task and may be rewarded. When your PR is merged you'll be prompted to rate the project — if this issue and the maintainers helped you ship, we'd be grateful for a 5-star rating. Clear questions in Discord and tidy, well-tested PRs are the fastest path to a merge and a reward.
Test pair-meta PATCH validation and info aggregation
Description
The pair-meta endpoints in
src/index.ts—PATCH .../fee_bps,/min,/max,/liquidity, andGET .../info— have only two tests insrc/__tests__/index.test.ts(a happy-path fee patch and one 404). The validation branches (feeBpsrange, integer-string regexes for min/max/liquidity) and the aggregate/infodefaults are untested. This issue adds thorough coverage for these handlers.Requirements and context
StableRoute-Org/Stableroute-backendonly.feeBps: 1001,minAmount: "01",maxAmount: "0"), and unregistered-pair 404.GET .../inforeturns the registered flag plus default meta (feeBps: 0,minAmount: "0", etc.) before any patch.{ error, message, requestId }shape on each 400/404.Suggested execution
git checkout -b test/pairs-15-meta-coveragesrc/__tests__/index.test.ts(or a newsrc/__tests__/pairMeta.test.ts).it()names mirroring the existing suite style.Test and commit
npm run build,npm run lint, andnpm test.feeBps0 and 1000, leading-zero amounts,maxAmountof0.npm testoutput and a coverage summary in the PR.Example commit message
test(pairs): cover pair-meta PATCH validation and info defaultsGuidelines
Community & contribution rewards