NestJS · Senior · Question 37 of 75
How do you test that guards, pipes and filters are wired correctly for a route?
- ✓Correct answer: With e2e tests through the HTTP layer: unauthorized requests get 401/403, invalid bodies get 400, errors have the expected format
- 2By reading the decorators manually
- 3With unit tests of the service only
Explanation
Unit tests of a controller method skip the enhancers, so wiring bugs only show up in HTTP-level tests.