📌 Description
QuoteService.quote, LiquidityService.addLiquidity, and SettlementService.open all funnel through the same requirePositiveNumber helper for their amount field, so their 400 responses for a non-positive amount should be identical in shape and message pattern. There doesn't appear to be a cross-route consistency test proving this — a future change to just one call site's error handling could silently diverge without any test catching it.
🧩 Requirements and context
- Add a table-driven test issuing a non-positive (
0, -1) amount to POST /api/v1/quote, POST /api/v1/liquidity, and POST /api/v1/settlements, asserting all three return 400 with the same error.code (BAD_REQUEST) and a message referencing "amount".
🛠️ Suggested execution
- Add the cross-route test, likely as a new test file (e.g.
src/routes/amountValidationConsistency.test.ts) or appended to an existing shared test setup, exercising all three routes via supertest against createApp().
✅ Acceptance criteria
🔒 Security notes
N/A — test-only; guards a cross-cutting validation consistency invariant relevant to defensive input handling.
📋 Guidelines
- Minimum 95% test coverage
- Clear documentation
- Timeframe: 96 hours
📌 Description
QuoteService.quote,LiquidityService.addLiquidity, andSettlementService.openall funnel through the samerequirePositiveNumberhelper for theiramountfield, so their 400 responses for a non-positive amount should be identical in shape and message pattern. There doesn't appear to be a cross-route consistency test proving this — a future change to just one call site's error handling could silently diverge without any test catching it.🧩 Requirements and context
0,-1)amounttoPOST /api/v1/quote,POST /api/v1/liquidity, andPOST /api/v1/settlements, asserting all three return400with the sameerror.code(BAD_REQUEST) and a message referencing"amount".🛠️ Suggested execution
src/routes/amountValidationConsistency.test.ts) or appended to an existing shared test setup, exercising all three routes via supertest againstcreateApp().✅ Acceptance criteria
amountacross all three routes.🔒 Security notes
N/A — test-only; guards a cross-cutting validation consistency invariant relevant to defensive input handling.
📋 Guidelines