Skip to content

feat(stripe-listener): add integration tests with PostgreSQL#54

Merged
geminimir merged 2 commits intogeminimir:mainfrom
coryli:feature/stripe-listener-integration-tests
Mar 13, 2026
Merged

feat(stripe-listener): add integration tests with PostgreSQL#54
geminimir merged 2 commits intogeminimir:mainfrom
coryli:feature/stripe-listener-integration-tests

Conversation

@coryli
Copy link
Contributor

@coryli coryli commented Mar 13, 2026

Summary

Add comprehensive integration tests for the Stripe Listener service that verify the full lifecycle from HTTP request through database persistence.

Changes

  • Add test fixtures for signed crypto payment payloads (succeeded, processing, failed)
  • Implement PostgresEventStore helper for integration testing against real PostgreSQL
  • Add integration tests covering:
    • Full lifecycle: HTTP request → signature verification → DB insert
    • Idempotent re-delivery of same event (duplicate handling)
    • Non-crypto event filtering (card payments, charge events)
    • Signature verification and tamper detection
    • Data transformation (cents to microUSDC conversion)
  • Tests gracefully skip when PostgreSQL is unavailable (CI-friendly)

How to Test

  1. npm ci
  2. npm run typecheck
  3. docker compose up -d postgres redis
  4. DATABASE_URL="postgres://stripeonchain:stripeonchain_dev@localhost:5432/stripeonchain" npm run migrate:up
  5. TEST_DATABASE_URL="postgres://stripeonchain:stripeonchain_dev@localhost:5432/stripeonchain" npm test

Tests

  • Tests added/updated
  • All tests pass (npm test)
  • Lint passes (npm run lint)
  • Type-check passes (npm run typecheck)
  • Formatting passes (npm run format:check)

Checklist

  • No secrets or credentials committed
  • Migrations run cleanly up and down (npm run migrate:up / npm run migrate:down)
  • Docker Compose starts without errors (docker compose up)

Related Issues

Closes #9

Made with Cursor

coryli added 2 commits March 12, 2026 20:20
Add comprehensive integration tests for the Stripe Listener service
that verify the full lifecycle from HTTP request through database
persistence.

Test coverage includes:
- Signed crypto payment_intent.succeeded/processing/failed payloads
- Full lifecycle: HTTP request → signature verification → DB insert
- Idempotent re-delivery handling (duplicate events)
- Non-crypto event filtering (card payments, non-payment_intent events)
- Signature verification and tamper detection
- Data transformation (cents to microUSDC conversion)

Closes geminimir#9

Made-with: Cursor
Integration tests now gracefully skip when the database connection
fails, allowing CI to pass without requiring a running PostgreSQL
instance. Tests still run fully when TEST_DATABASE_URL points to
an available database.

Made-with: Cursor
@geminimir geminimir merged commit b9ea12e into geminimir:main Mar 13, 2026
1 check passed
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.

Integration tests: Stripe Listener with mocked Stripe payloads

2 participants