.overrideGuard(JwtAuthGuard).useValue({ canActivate: () => true })Use overrideGuard(). Guards bound with @UseGuards() are enhancers, not regular providers. So the testing module has special methods for them: overrideGuard(), overrideInterceptor(), overridePipe() and overrideFilter().
".overrideProvider(JwtAuthGuard).useValue(...)" only works for a guard registered as an APP_GUARD provider. It doesn't work for a guard attached with the decorator. ".overrideModule(JwtAuthGuard).useModule(...)" is wrong because a guard is not a module.
Read more
- Testing (https://docs.nestjs.com/fundamentals/testing)docs.nestjs.com