NestJS Practice Test
NestJS NestJS Testing & Debugging 3
How do you test a NestJS `CanActivate` guard in isolation?
Select your answer
A
Mount it in an e2e test and check the HTTP response status
B
Instantiate the guard directly and call its `canActivate()` method with a mock `ExecutionContext`
C
Use `app.useGlobalGuards()` inside the test module
D
Decorate the test controller with `@UseGuards()` and verify route access
Hint
✨ Remove Ads & Unlock Every Exam
— From $1.49
🃏 Study This Quiz as Flashcards →