Integration Testing Pattern

Test complete user flows and service interactions with database integration, API endpoint testing, webhook verification, and transaction safety.

What's Included#

  • Test database setup with Prisma cleanup and optional test containers
  • Complete user flow tests (register, login, create content) with database verification
  • API integration tests using supertest with Next.js server
  • Service integration tests with mocked external dependencies
  • Webhook testing with signature verification and database state assertions

Usage#

Via CLI#

Loading code block...

Via AI Assistant#

Ask your AI assistant:

  • "Use the integration testing pattern from Bootspring"
  • "Apply the Bootspring integration testing pattern to my project"

Key Considerations#

  • Isolate tests by cleaning database state in beforeEach hooks
  • Use a separate test database or test containers, never the production database
  • Mock external third-party services but test your own integration code thoroughly
  • Test both happy paths and error scenarios including payment failures and auth errors
  • Verify side effects like database records created, emails sent, and cache invalidation