Skip to content

test(payments): add HTTP integration tests for payment quote lifecycle (#256) - #352

Merged
David-patrick-chuks-02 merged 2 commits into
Lilly-Protocol:mainfrom
ghzhost:test/payment-quote-lifecycle-integration
Sep 6, 2026
Merged

test(payments): add HTTP integration tests for payment quote lifecycle (#256)#352
David-patrick-chuks-02 merged 2 commits into
Lilly-Protocol:mainfrom
ghzhost:test/payment-quote-lifecycle-integration

Conversation

@ghzhost

@ghzhost ghzhost commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Closes #256

Adds a comprehensive supertest integration suite (tests/payments-routes.test.ts) exercising the full /api/v1/payments HTTP route lifecycle.

Changes

  • POST /api/v1/payments: verified that sending valid input (sourceAsset, destinationAsset, sourceAmount) creates an active quote with status 201 and expected response envelope { success: true, data: { quote: ... } }.
  • GET /api/v1/payments/quotes/:id:
    • Live quote returns 200 with quote payload.
    • Non-existent quote returns 404 (Quote not found).
    • Expired quote (>5m TTL) returns 410 (Quote has expired).
  • POST /api/v1/payments/execute:
    • Non-existent quote returns 404.
    • Unconfirmed payment (confirmed: false) returns 400 (Payment must be confirmed).
    • Valid execution returns 200 with settled payment record and updates quote status.
    • Repeated execution on already-executed quote returns 409 (Quote has already been executed).
    • Expired quote execution returns 410 (Quote has expired).

Verification

  • npx vitest run tests/payments-routes.test.ts tests/payments.schema.test.ts tests/payments.test.ts tests/payments-fee.test.ts passes (41 tests).
  • npm run lint, npm run typecheck, and npm run build pass with zero errors.

@David-patrick-chuks-02
David-patrick-chuks-02 merged commit 114106e into Lilly-Protocol:main Sep 6, 2026
1 check failed
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.

[Bounty: $45] Add HTTP integration tests for the full payment quote lifecycle

3 participants