0PricingLogin
tRPC End-to-End Type Safe APIs · Lesson

Integration Testing tRPC Routers

Set up integration tests to verify the correct interaction between different tRPC procedures and their dependencies.

What are Integration Tests?

Welcome to integration testing for tRPC! While unit tests check individual functions, integration tests verify how different parts of your tRPC application work together.

This often involves testing the interaction between tRPC procedures and external dependencies, like a database or another service.

Unit vs. Integration Tests

Let's clarify the difference:

  • Unit Tests: Focus on isolating a single tRPC procedure. They mock all external dependencies to test the procedure's logic alone.
  • Integration Tests: Test the flow between multiple procedures or between a procedure and a real (or mocked) external dependency, like ensuring a mutation correctly updates a database.

All lessons in this course

  1. Unit Testing tRPC Procedures
  2. Integration Testing tRPC Routers
  3. End-to-End Testing Strategies
  4. Mocking Context and Dependencies in tRPC Tests
← Back to tRPC End-to-End Type Safe APIs