title: How can I test a controller with more than one guard on NestJS
body: <p>I'm testing my controller but I'm having a problem to mock the guards of that controller. My app was developed with NestJs version 6.13.1</p>
  
  <p>I can override one guard to mock it, as the snipped below:</p>
  
  <pre><code>const fakeGuard: CanActivate = { canActivate: () =&gt; true };
  
  beforeEach(async () =&gt; {
      const module: TestingModule = await Test.createTestingModule({
          imports: [
              CoreModule,
              AuthModule,
              PermissionsModule,
              UsersModule
          ],
          controllers: [UsersController],
      })
      .overrideGuard(AuthGuard('jwt')).useValue(fakeGuard) // When I have one guard in my controller it works right
      .compile();
  
      controller = module.get&lt;UsersController&gt;(UsersController);
      app = module.createNestApplication();
      app.init();
  });
  </code></pre>
  
  <p>But in my scenario, I have 2 guards defined in my controller</p>
  
  <pre><code>@UseGuards(AuthGuard('jwt'), PermissionGuard)
  export class UsersController {
      ...
  }
  </code></pre>
  
  <p>I didn't find a way to mock more than one guard. I tried pass 2 guards when I call overrideGuard, but when I ran the test didn't work with any exception. But I know, the problem is because I couldn't mock those two guards. If you faced the same problem, share with me your solution, thanks.</p>