diff --git a/test/test-setup.ts b/test/test-setup.ts index 9e235ac5e..1e3c7501d 100644 --- a/test/test-setup.ts +++ b/test/test-setup.ts @@ -55,7 +55,7 @@ export class TestSetup { users: User[] = []; - public static async create(): Promise { + public static async create(withMockAuth = true): Promise { const testSetup = new TestSetup(); const routes: Routes = [ { @@ -68,7 +68,7 @@ export class TestSetup { }, ]; - testSetup.moduleRef = await Test.createTestingModule({ + const testingModule = await Test.createTestingModule({ imports: [ RouterModule.forRoutes(routes), TypeOrmModule.forRoot({ @@ -104,10 +104,13 @@ export class TestSetup { FrontendConfigModule, IdentityModule, ], - }) - .overrideGuard(TokenAuthGuard) - .useClass(MockAuthGuard) - .compile(); + }); + + if (withMockAuth) { + testingModule.overrideGuard(TokenAuthGuard).useClass(MockAuthGuard); + } + + testSetup.moduleRef = await testingModule.compile(); testSetup.userService = testSetup.moduleRef.get(UsersService); testSetup.configService =