11import { createMock , DeepMocked } from '@golevelup/ts-jest' ;
2- import { RequestContextModule } from '@medibloc/nestjs-request-context' ;
2+ import { HttpInterceptor } from '@lib/core' ;
3+ import { AsyncContext , DatabaseProvider , Transactions } from '@lib/repository' ;
4+ import { AppWrap } from '@lib/testing' ;
35import { ModuleRef } from '@nestjs/core' ;
46import { JwtModule } from '@nestjs/jwt' ;
57import { Test } from '@nestjs/testing' ;
68import * as cookieParser from 'cookie-parser' ;
79import * as request from 'supertest' ;
810import { v4 } from 'uuid' ;
9- import { ConfigProvider } from '../../../core/config/config.core' ;
10- import { DatabaseProvider } from '../../../core/database/database.core' ;
11- import { HttpInterceptor } from '../../../core/interceptor.core' ;
12- import { AuthServiceProvider } from '../../../services/auth/auth.service' ;
13- import { JwtRefreshTokenStrategy } from '../../../services/auth/strategies/jwt-refresh.strategy' ;
14- import { JwtStrategy } from '../../../services/auth/strategies/jwt.strategy' ;
15- import { MailServiceProvider } from '../../../services/mail/mail.service' ;
16- import { TokenServiceProvider } from '../../../services/token/token.service' ;
17- import { UserServiceProvider } from '../../../services/user/user.service' ;
18- import { AppWrap } from '../../../utils/tests.utils' ;
19- import { ConfigServiceFake } from '../../../__mocks__/ConfigServiceFake' ;
20- import { TransactionsContextFake } from '../../../__mocks__/TransactionsContextFake' ;
21- import { getUserStub } from '../../../__mocks__/user.stub' ;
11+ import { ConfigProvider } from '../../../../core/config/config.core' ;
12+ import { AuthServiceProvider } from '../../../../services/auth/auth.service' ;
13+ import { JwtRefreshTokenStrategy } from '../../../../services/auth/strategies/jwt-refresh.strategy' ;
14+ import { JwtStrategy } from '../../../../services/auth/strategies/jwt.strategy' ;
15+ import { MailServiceProvider } from '../../../../services/mail/mail.service' ;
16+ import { TokenServiceProvider } from '../../../../services/token/token.service' ;
17+ import { UserServiceProvider } from '../../../../services/user/user.service' ;
18+ import { ConfigServiceFake } from '../../../../__mocks__/ConfigServiceFake' ;
19+ import { getUserStub } from '../../../../__mocks__/user.stub' ;
2220import { AuthControllerProvider } from '../auth.controller' ;
2321
2422describe ( 'AuthController' , ( ) => {
@@ -37,10 +35,6 @@ describe('AuthController', () => {
3735 secret : configService . JWT_SECRET ,
3836 signOptions : { expiresIn : configService . JWT_EXPIRES_IN } ,
3937 } ) ,
40- RequestContextModule . forRoot ( {
41- contextClass : TransactionsContextFake ,
42- isGlobal : true ,
43- } ) ,
4438 ] ,
4539 providers : [
4640 {
@@ -81,7 +75,11 @@ describe('AuthController', () => {
8175
8276 appWrap . app = module . createNestApplication ( ) ;
8377 appWrap . app . useGlobalInterceptors (
84- new HttpInterceptor ( createMock < ModuleRef > ( ) , db as unknown as DatabaseProvider ) ,
78+ new HttpInterceptor (
79+ createMock < ModuleRef > ( ) ,
80+ createMock < AsyncContext < string , Transactions > > ( ) ,
81+ db as unknown as DatabaseProvider ,
82+ ) ,
8583 ) ;
8684 appWrap . app . use ( cookieParser ( ) ) ;
8785 await appWrap . app . init ( ) ;
0 commit comments