Skip to content

test(quotes): add comprehensive API HTTP contract integration test suite - #47

Merged
whiteghost0001 merged 1 commit into
LuminaRail:mainfrom
olawaleakanbi035-maker:main
Sep 14, 2026
Merged

whiteghost0001 merged 1 commit into
LuminaRail:mainfrom
olawaleakanbi035-maker:main

Conversation

@olawaleakanbi035-maker

Copy link
Copy Markdown
  • Create API contract integration test suite in tests/api/quotes-contract.test.ts covering POST /api/v1/quotes and related endpoints.
  • Minimum Amount: Enforces minNgnAmount limits (HTTP 400 for amounts under threshold).
  • Maximum Amount: Enforces maxNgnAmount and maxQuoteUsdcAmount limits.
  • Fee Rounding: Validates platform fee rounding and net source calculations.
  • USDC Truncation: Guarantees destination amount payout conforms to 6-decimal USDC precision bounds.
  • Spread Application: Verifies exchange rate spread calculations in quotes.
  • Network Fee Calculation: Asserts network fee presence and values in response payload.
  • Stale FX Rate: Validates HTTP 502 error responses when FX provider rate is stale.
  • Quote Expiration: Validates automatic status transition to EXPIRED and order rejection for expired quotes.
  • Quote Reuse Prevention: Validates single-use quote restriction when placing orders.
  • Quote/Order Mismatch: Verifies created orders strictly derive values from server quotes.
  • Liquidity Availability: Validates liquidityAvailable response status and order rejection when pool is depleted.
  • Malformed Payloads: Validates HTTP 400 validation error responses for bad parameters, negative/zero amounts, invalid UUIDs, and unsupported currency pairs.

Summary of Changes

Brief description of what this PR introduces, fixes, or refactors in luminarail-backend.

Related Contributor Issue: Closes #


Type of Change

  • Bug fix (non-breaking change fixing an API issue)
  • New feature (non-breaking change adding an endpoint or worker feature)
  • Breaking change (change breaking existing API contracts or schema)
  • Documentation update
  • Refactoring / Test coverage addition

Verification & Quality Checklist

  • TypeScript check passes cleanly: npm run type-check
  • ESLint passes cleanly: npm run lint
  • Production build compiles cleanly: npm run build
  • All Vitest tests pass cleanly: npm test
  • Zod schema validation added for new request parameters
  • Financial amounts use string representation / Decimal handling (no float rounding)
  • Idempotency-Key headers respected for financial mutations
  • No API keys, JWT secrets, database credentials, or Stellar seed phrases committed

Test Verification Output

npm test
# Paste test results here

- Create API contract integration test suite in tests/api/quotes-contract.test.ts covering POST /api/v1/quotes and related endpoints.
- Minimum Amount: Enforces minNgnAmount limits (HTTP 400 for amounts under threshold).
- Maximum Amount: Enforces maxNgnAmount and maxQuoteUsdcAmount limits.
- Fee Rounding: Validates platform fee rounding and net source calculations.
- USDC Truncation: Guarantees destination amount payout conforms to 6-decimal USDC precision bounds.
- Spread Application: Verifies exchange rate spread calculations in quotes.
- Network Fee Calculation: Asserts network fee presence and values in response payload.
- Stale FX Rate: Validates HTTP 502 error responses when FX provider rate is stale.
- Quote Expiration: Validates automatic status transition to EXPIRED and order rejection for expired quotes.
- Quote Reuse Prevention: Validates single-use quote restriction when placing orders.
- Quote/Order Mismatch: Verifies created orders strictly derive values from server quotes.
- Liquidity Availability: Validates liquidityAvailable response status and order rejection when pool is depleted.
- Malformed Payloads: Validates HTTP 400 validation error responses for bad parameters, negative/zero amounts, invalid UUIDs, and unsupported currency pairs.
@whiteghost0001
whiteghost0001 merged commit 4503abf into LuminaRail:main Sep 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants